compound statement missing } infunction create 模块2 第一行show(char filename[])显示exp
#include "stdio.h"#define STUDENT struct stu_str
struct stu_str{
char num[10];
char name[20];
float score[4];
}
#include "stru.h"
main()
{
char in_ch,filname[20];
while(1)
{
clrscr();
printf("1.Iput students records.\n");
printf("2.Show students records.\n");
printf("3.Modify students records.\n");
printf("4.Append student records.\n");
printf(" average.\n");
printf("6.Sort.\n");
printf("0.Exit.\n");
if((in_ch=getchar())=='0')
{
printf("Good bye!\n");
getch();
break;
}
switch(in_ch)
{
case 48:break;
case 49:create();break;
case 50:printf("\nPlease input filename:");
scanf("%s",filename);
show(filename);
break;
case 51:modify();break;
case 52:append();break;
case 53:compute();break;
case 54:sort();break;
}
}
}
show(char filename[])
{
FILE * fp;
STUDENT stud;
int i,stu_c;
if((fp=fopen(filename,"rb"))==NULL)
{
printf("File open error!\n");
exit(1);
}
clrscr();
printf("|Number|Name|Compute|Math|Eenglish|Average|\n");
printf(" \n");
while(1)
{
if(fread(&stud,sizeof(STUDENT),1,fp))
printf("|%8s|%15s|%8.1f|%8.1f|%8.1f|%8.1f|\n",stud.num,stud.name,stud.score[0],stud.score[1],stud.score[2],sted.score[3]);
else
break;
}
printf(" \n");
fcose(fp);
printf("Press any continue...\n");
getch();
}