【正文】
stu[i].name,stu[i].math,stu[i].english,stu[i].Chinese,stu[i].physics,stu[i].puter)。 save()。 printf(\n\n Press any key to return to the menu)。 getch()。}void sort_score() /*按分?jǐn)?shù)排序*/{ int i,j,t。 char str[10]。 clrscr()。 for(i=0。inumber。i++) stu[i].total=stu[i].math+stu[i].english+stu[i].Chinese+stu[i].physics+stu[i].puter。 for(j=0。jnumber。j++) for(i=0。inumber1j。i++) { if(stu[i].totalstu[i+1].total) { strcpy(str,stu[i].name)。 strcpy(stu[i].name,stu[i+1].name)。 strcpy(stu[i+1].name,str)。 strcpy(str,stu[i].num)。 strcpy(stu[i].num,stu[i+1].num)。 strcpy(stu[i+1].num,str)。 t=stu[i].math。 stu[i].math=stu[i+1].math。 stu[i+1].math=t。 t=stu[i].english。 stu[i].english=stu[i+1].english。 stu[i+1].english=t。 t=stu[i].Chinese。 stu[i].Chinese=stu[i+1].Chinese。 stu[i+1].Chinese=t。 t=stu[i].physics。 stu[i].physics=stu[i+1].physics。 stu[i+1].physics=t。 t=stu[i].puter。 stu[i].puter=stu[i+1].puter。 stu[i+1].puter=t。 t=stu[i].total。 stu[i].total=stu[i+1].total。 stu[i+1].total=t。 } } printf(\n\nname num math englis Chinese physics puter total\n)。 for(i=0。inumber。i++) printf(%10s%10s%10d%10d%10d%10d%10d%10d\n,stu[i].name,stu[i].num,stu[i].math,stu[i].english,stu[i].Chinese,stu[i].physics,stu[i].puter,stu[i].total)。 save()。 printf(\n\n Press any key to return to the menu)。 getch()。} void browse() /*瀏覽數(shù)據(jù)*/{ int i。 clrscr()。/* FILE*fp。*/ fp=fopen(stu_list,rb)。 printf(\n\nname num math englis Chinese physics puter\n)。 for(i=0。inumber。i++) { fread(amp。stu[i],sizeof(struct student),1,fp)。 printf(%10s%10s%10d%10d%10d%10d%10d\n,stu[i].name,stu[i].num,stu[i].math,stu[i].english,stu[i].Chinese,stu[i].physics,stu[i].puter)。 } fclose(fp)。 printf(\n\n Press any key to return to the menu)。 getch()。}void open_file() /* 打開(kāi)文件*/{ int i。 char fname[10]。 clrscr()。 printf(\n\n\tPlease input the file name which you want to open:)。 scanf(%s,fname)。 getch()。 if((fp1=fopen(fname,r))!=NULL) { fscanf(fp1,%d,amp。number)。 // fclose(fp1)。 printf(\nnumber:%d\n,number)。 printf(\nname num math englis Chinese physics puter\n)。 // fp1=fopen(fname,r)。 for(i=0。inumber。i++) { /*注意下面的格式要和之前的一樣。要不會(huì)亂碼*/ fscanf(fp1,%s %s %d %d %d %d %d,stu[i].name,stu[i].num,amp。stu[i].math,amp。stu[i].english,amp。stu[i].Chinese,amp。stu[i].physics,amp。stu[i].puter)。 printf(%10s%10s%10d%10d%10d%10d%10d\n,stu[i].name,stu[i].num,stu[i].math,stu[i].english,stu[i].Chinese,stu[i].physics,stu[i].puter)。 } fclose(fp1)。 } else printf(\terror)。 printf(\n\n\tPress any key to return to the menu...)。 getch()。}void main(){ int num。 clrscr()。 gotoxy(3,2)。 for(i=0。i37。i++) printf(* )。 gotoxy(10,5)。 printf(Wele to student achievement management system)。 gotoxy(10,7)。 printf(Producer: Wang xuezheng)。 gotoxy(10,9)。 printf(Student number: 3109008789)。 gotoxy(10,11)。 printf(Class: Electronic 5 class)。 gotoxy(3,14)。 for(i=0。i37。i++) printf(* )。 printf(\n\n\n\tPlease press any key to continue...)。 getch()。 while(1) { menu()。 scanf(%d,amp。num)。 switch(num) { case 1:new_file()。break。 case 2:edit_data()。break。 case 3:calculate(number)。break。 case 4:search()。break。 case 5:sort()。break。 case 6:browse()。break。 case 7:open_file()。break。 case 0:exit(0)。 } } }寧可累死在路上,也不能閑死在家里!寧可去碰壁,也不能面壁。是狼就要練好牙,是羊就要練好腿。什么是奮斗?奮斗就是每天很難,可一年一年卻越來(lái)越容易。不奮斗就是每天都很容易,可一年一年越來(lái)越難。能干的人,不在情緒上計(jì)較,只在做事上認(rèn)真;無(wú)能的人!不在做事上認(rèn)真,只在情緒上計(jì)較。拼一個(gè)春夏秋冬!贏一個(gè)無(wú)悔人生!早安!—————獻(xiàn)給所有努力的人.學(xué)習(xí)好幫手