C语言的这个小程序 编译器说它有错误 可我真的看不出开哪里错了....

//Information management 1.1.c
#include<stdio.h>
#include<string.h>
#define maxname 40
#define maxsex 5
#define maxnum 40

struct data{
char s_name[maxname];
char s_sex[maxsex];
int s_age;
};

int main(void)
{
struct date man[maxnum];
int option;
int count = 0;
int index;
char loop = 'y';
while (loop == 'y' || loop == 'Y')
{
printf("Welcome to use the this program~\n");
printf("Please select your want to use the function: \n");
printf(" 1.Information Input.\n");
printf(" 2.Information Inquiry.\n");
printf(" 3.Information Deleted.\n");
printf(" 4.Exit.\n");
do {
scanf("%d", &option);
if (option < 0 || option>4)
printf("Input Erro!\nPlease enter again: ");
} while (option < 0 || option>4);

if (option = 1)
{
printf("Please enter the name: \n");
printf("If you want to quit,Please [enter] for name to quit.");
while (count < maxnum && gets(man[count].s_name) != NULL && man[count].s_name[0] != '\n')
{
printf("Please enter the sex: \n");
gets(man[count].s_sex);
printf("Please enter the age: \n");
scanf("%d", &man[count++].s_age);
while (gets() != '\n')
continue;
if (count < maxnum)
puts("Please enter next name: ");
}
puts("Bye!");
}
else if (option = 2)
{
for (index = 0; index < count; index++)
{
printf("%s\n", man[index].s_name);
printf("%s\n", man[index].s_sex);
printf("%d\n", man[index].s_age);
puts("\n\n");
}
puts("Do you wang to go back to the main menu?(Y,Yse N,No)");
getchar();
scanf("%c", &loop);
}
puts("Bye");

}
system("pause");
return 0;
}
//程序没做完 只编了一小部分 想先试试好不好使...

大兄弟,你的结构体变量定义错了,是data不是date;追问

.... 好尴尬⊙﹏⊙‖∣°

温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答