我做了一个循环,不要一次又一次地重复一切。但是每当我尝试输入我的名字时,它都不允许我处理取消。这个怎么做?
int new_acc(FILE * fp, char *name, size_t namesize, char *dob, size_t dobsize){
int one_by_one;
char listing[8][15] = {"Name","Date of birth"};
char another_list[8][15] = {"name","dob"}; // These two
char list_size[8][15] = {"namesize","dobsize"}; // lines are having problem.
for (int i=0; i<one_by_one; i++){
printf("Enter your %s: ",listing + i);
fgets(another_list + i, list_size, stdin);
}
/* This is without loop printing */
printf("Enter your name: ");
fgets(name, namesize, stdin);
fputs(name, fp);
printf("Enter your Date of Birth: ");
fgets(dob, dobsize, stdin);
fputs(dob, fp);
fclose(fp);
return 0;
}