请教c的大大一个问题
#include <stdio.h>#include <string.h>
int count = 0,i,flag;
struct student
{
char name[8]; /*学号,姓名,年龄,性别,出生年月,地址,电话,E-mail*/
char gender[2];
int age;
char number[20];
char years[10];
char address[80];
char telephone[11];
char email[50];
};
struct student stu[100];
new_student ()
{
struct student temp;
printf ("请您输入学生的姓名:");
scanf ("%s", temp.name);
printf ("请您输入学生的性别:");
scanf ("%s", temp.gender);
printf ("请您输入学生的年龄:");
scanf ("%d", &temp.age);
printf ("请您输入学生的学号:");
scanf ("%s", temp.number);
printf ("请您输入学生的出生年月:");
scanf ("%s", temp.years);
printf ("请您输入学生的地址:");
scanf ("%s", temp.address);
printf ("请您输入学生的联系电话:");
scanf ("%s", temp.telephone);
printf ("请您输入学生的邮箱:");
scanf ("%s", temp.email);
stu[count] = temp;
count++;
}
search_name ()
{
int choice2;
char findname[8],findnumber[20];
printf ("请您选择查询方式(姓名或学号):");
scanf ("%d", &choice2);
switch (choice2)
{
case 1:
printf ("请您输入学生的姓名: ");
scanf ("%s", findname);
for (i = 0; i < 100; i++)
{
if (strcmp(findname,stu[i].name)==0)
{
flag = 1;
break;
}
}
if (flag)
{
printf("姓名: %s\n",stu[i].name);
printf("性别: %s\n",stu[i].gender);
printf("年龄: %d\n",stu[i].age);
printf("出生年月: %s\n",stu[i].years);
printf("地址: %s\n",stu[i].address);
printf("联系号码: %s\n",stu[i].telephone);
printf("E-mail: %s\n",stu[i].email);
}
else
{
printf ("查不此人!!!\n");
}
break;
case 2:
printf ("请您输入学生的学号: ");
scanf ("%s", findnumber);
for (i = 0; i < 100; i++)
{
if (strcmp(findnumber,stu[i].number)==0)
{
flag = 1;
break;
}
}
if (flag)
{
printf("姓名: %s\n",stu[i].name);
printf("性别: %s\n",stu[i].gender);
printf("年龄: %d\n",stu[i].age);
printf("出生年月: %s\n",stu[i].years);
printf("地址: %s\n",stu[i].address);
printf("联系号码: %s\n",stu[i].telephone);
printf("E-mail: %s\n",stu[i].email);
}
else
{
printf ("查不此人!!!\n");
}
break;
main ()
{
int choice;
printf("\n\t\t* * * * * 学生信息管理系统 * * * *\n");
printf("\t\t*\t1.学生信息录入功能\t *\n");
printf("\t\t*\t2.学生信息查询功能\t *\n");
printf("\t\t*\t3.退出成绩管理系统\t *\n");
printf("\t\t* * * * * 提供 * * * * * *\n\n");
do
{
printf("\n请输入你要执行的操作:");
scanf ("%d", &choice);
switch (choice)
{
case 1:
new_student ();
break;
case 2:
search_name ();
break;
case 3:
break;
}
}while (choice != 3);
}
错误:::
F:\\\1.c(101) : warning C4013: 'main' undefined; assuming extern returning int
F:\\\1.c(103) : error C2143: syntax error : missing ';' before '{'
F:\\\1.c(127) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
1.exe - 2 error(s), 1 warning(s)