#include <stdio.h>
struct student
{
char number[11];
char name [25];
char sex;
int age;
float score[3];
float sum;
float aver;
int i,j;
};
struct student stu[10]={
{"3106005748","LanTianRan",'M',20,90,90,90},
{"3000000001","huangLei",'M',21,59,59,90},
{"3000000002","huangMing",'F',17,89,70,90},
{"3000000003","JinLing",'F',20,20,84,30},
{"3000000004","LiMing",'F',20, 89,50,90},
{"3000000005","LiHua",'F',48, 20,40,50},
{"3000000006","LiMing",'F',20, 95,84,85},
{"3000000007","Lichao",'F',20, 60,60,70},
{"3000000008","Lijia",'F',20, 96,84,90},
{"3000000009","Lishan you",'F',19,89,84,90}
};
void main()
{ int n;
printf("\n\n\n\n");
printf("\t\t\t ****************************\n\n");
printf("\t\t\t Class: 06dianzishangwu06 Name:蓝天然 3106005748\n\n");
printf("\t\t\t *** welcome to system *** \n\n");
printf("\t\t\t ****************************\n\n\n\n");
printf("\t\t\t 1 成绩显示 \n\n");
printf("\t\t\t 2 成绩排序 \n\n");
printf("\t\t\t 3 成绩查找 \n\n");
printf("\t\t\t 4 成绩统计 \n\n");
printf("\t\t\t 0 退出系统 \n\n");
do
{
scanf("%d",&n);
switch(n)
{
case 1:lty();
case 2:secrch();
}
}while((n>3)&&(n<1)); }
secrch()
{
int n,i;
printf("请输入学生学号:");
scanf("%10s",&i);
for(n=0;n<10;n++)
{
if(stu[10].number==i&&stu[10].number!=0)
{
printf("学号:%d\n",stu[10].number);
printf("姓名:%s\n",stu[10].name);
printf("年龄:%d\n",stu[10].age);
return n;
}
}
printf("\n输入错误或学号不存在.\n");
return -1;
}
lty()
{struct student *p;
printf("\tNo. Name sex age math english computer\n ");
for(p=stu;p<stu+10;p++)
printf(" %10s %-12s %2c %4d %3.1f %3.1f %3.1f\n",
p->number,p->name,p->sex,p->age,p->score[1],p->score[2],p->score[2]);
getch();
}
进入操作菜单后,按2输入学号后却提示说没有这个学号,高手请指教