#include <stdio.h>
struct student
{
char number[11];
char name [25];
char sex;
int age;
float score[3];
float sum;
float aver;
char math;
char english;
char computer;
};
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:ksyx();
}
}while((n>3)&&(n<1)); }
ksyx()
{struct student *p;
printf("No. Name sex age math english computer\n ");
for(p=stu;p<stu+10;p++)
printf("%10s %-12s %2c %4d\n",p->number,p->name,p->sex,p->age,p->math,p->english,p->computer);
getch();}
这是小弟刚做的一个,不过就是进入时按1成绩显示时显示头一行与后面的不对齐的,
另一个问题就是后面的三科成绩输不出来,高手指点一下