고등학교 이과 학생 성적 관리 시스템 (C 언어 과정 설계)

소스 코드 부분
#include
#include
#include
#define LEN sizeof(Student1)
typedef struct Student
{ 
		long long xuehao;
		char xingming[20]; 
		char xingbie[2]; 
		int nianji;
		int banji;
		int yuwen;
		int shuxue;
		int yingyu;
		int lizong;
		int zongfen;
		struct Student *next;
}Student1;
void chazhao()
{//  。             ,          
    FILE *fp;
	int i=0,n=0,k;
	if((fp=fopen("grade.txt","r"))==NULL)
	{
	    printf("%s
"," "); } Student1 *p1,*p2,*p3,*head; p2=head=(Student1 *)malloc(LEN);//head head->next=NULL; while(!feof(fp)) { p1=(Student1 *)malloc(LEN); fscanf(fp,"%lld %s %s %d%d%d%d%d%d%d",&p1->xuehao,p1->xingming,p1->xingbie,&p1->nianji,&p1->banji,&p1->yuwen,&p1->shuxue,&p1->yingyu,&p1->lizong,&p1->zongfen); printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); p2->next=p1; p2=p1; } fclose(fp); p1->next=NULL; void xuehaochazhao(Student1 *p); void xingmingchazhao(Student1 *p); //#################################################################################################################### while(1) { system("clear"); printf("%s
","1. 1"); printf("%s
","2. 2"); scanf("%d",&i); system("clear"); switch(i) { case 1:xuehaochazhao(head);break; case 2:xingmingchazhao(head);break; default:printf("%s
"," "); } printf("%s
"," 0 , "); scanf("%d",&k); system("clear"); if(k==0) {// , p1=head; while(p1!=NULL) { p3=p1->next; free(p1); p1=p3; } break; } } } void xuehaochazhao(Student1 *p) { int i,k; Student1 *p1,*p2,*p3,*head; while(1) { p1=p->next; long long m; printf("%s
"," "); scanf("%lld",&m); while(p1->next!=NULL && p1->xuehao!=m) { p1=p1->next; } if(p1->xuehao==m) { printf(" %lld %s, %s, %d, %d, :%d :%d :%d :%d :%d
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); } else { printf("%s
"," "); } printf("%s
"," 0 , "); scanf("%d",&k); system("clear"); if(k==0) {// break; } } } void xingmingchazhao(Student1 *p) { char a[20]; int k; Student1 *p1,*p2,*p3,*head; while(1) { p1=p->next; printf("%s
"," "); scanf("%s",a); while(p1->next!=NULL && strcmp(p1->xingming,a)!=0) { p1=p1->next; } if(strcmp(p1->xingming,a)==0) { printf("%s %lld, %s, %d, %d, :%d :%d :%d :%d :%d
",p1->xingming,p1->xuehao,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); } else { printf("%s
"," "); } printf("%s
"," 0 , "); scanf("%d",&k); system("clear"); if(k==0) { break; } } } //############################################################################################### void xiugai() {// int i=0,n=0,g,k; long long m; FILE *fp; system("clear"); if((fp=fopen("grade.txt","r"))==NULL) { printf("%s
"," "); } printf("%s\t"," "); printf("%s\t\t"," "); printf("%s\t\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t
"," "); Student1 *p1,*p2,*p3,*head; p2=head=(Student1 *)malloc(LEN);//head head->next=NULL; while(!feof(fp)) { p1=(Student1 *)malloc(LEN); fscanf(fp,"%lld %s %s %d%d%d%d%d%d%d",&p1->xuehao,p1->xingming,p1->xingbie,&p1->nianji,&p1->banji,&p1->yuwen,&p1->shuxue,&p1->yingyu,&p1->lizong,&p1->zongfen); printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); p2->next=p1; p2=p1; } fclose(fp); p1->next=NULL; while(1) { p1=head->next; char a[5]; printf("%s
"," , , "); scanf("%lld%s %d",&m,a,&g); while(p1->xuehao!=m) { p1=p1->next; } if(p1->xuehao==m) { p3=p1; if(strcmp(a," ")==0) { p1->yuwen=g; } else if(strcmp(a," ")==0) { p1->shuxue=g; } else if(strcmp(a," ")==0) { p1->yingyu=g; } else if(strcmp(a," ")==0) { p1->lizong=g; } else { printf("%s
"," "); } } else { printf("%s
"," "); } p1->zongfen=p1->yuwen+p1->shuxue+p1->yingyu+p1->lizong; p1=head->next; if((fp=fopen("grade.txt","r+"))==NULL) { printf("%s
"," "); } while(p1!=NULL) { if(p1->next==NULL) fprintf(fp,"%lld %s %s %d %d %d %d %d %d %d",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); else fprintf(fp,"%lld %s %s %d %d %d %d %d %d %d
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); p1=p1->next; } fclose(fp); printf("%s
"," "); printf("%s
"," 0 , "); scanf("%d",&k); if(k==0) { p1=head; while(p1!=NULL) { p3=p1->next; free(p1); p1=p3; } break; } } } //############################################################################################### void tianjia() {// 。 , , system("clear"); int i=1,k; long long m; FILE *fp; if((fp=fopen("grade.txt","r"))==NULL) { fp=fopen("grade.txt","w"); } Student1 *p1,*p2,*p3,*head; p2=head=(Student1 *)malloc(LEN);//head head->next=NULL; while(!feof(fp)) { p1=(Student1 *)malloc(LEN); fscanf(fp,"%lld %s %s %d%d%d%d%d%d%d",&p1->xuehao,p1->xingming,p1->xingbie,&p1->nianji,&p1->banji,&p1->yuwen,&p1->shuxue,&p1->yingyu,&p1->lizong,&p1->zongfen); printf("%lld %s %s %d %d %d %d %d %d %d
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); p2->next=p1; p2=p1; } fclose(fp); while(1) { system("clear"); p1=(Student1 *)malloc(LEN); printf(" %d , , , , , , , , ,
",i); scanf("%lld %s %s %d%d%d%d%d%d",&p1->xuehao,p1->xingming,p1->xingbie,&p1->nianji,&p1->banji,&p1->yuwen,&p1->shuxue,&p1->yingyu,&p1->lizong); p1->zongfen=p1->yuwen+p1->shuxue+p1->yingyu+p1->lizong; p2->next=p1; p2=p1; i++; printf("%s
"," 0 , "); scanf("%d",&k); if(k==0) { p1->next=NULL; break; } } //printf("***********************************************
"); if((fp=fopen("grade.txt","w"))==NULL) { printf("%s
"," "); } p1=head->next; while(p1!=NULL) { if(p1->next==NULL) { fprintf(fp,"%lld %s %s %d %d %d %d %d %d %d",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); p3=p1->next; free(p1); p1=p3; } else { fprintf(fp,"%lld %s %s %d %d %d %d %d %d %d
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); p3=p1->next; free(p1); p1=p3; } } fclose(fp); printf("%s
"," "); } //############################################################################################### void shanchu() {// FILE *fp; if((fp=fopen("grade.txt","r"))==NULL) { printf("%s
"," "); } printf("%s\t"," "); printf("%s\t\t"," "); printf("%s\t\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t
"," "); Student1 *p1,*p2,*p3,*head; int i=0,k; p2=head=(Student1 *)malloc(LEN);//head head->next=NULL; while(!feof(fp)) { p1=(Student1 *)malloc(LEN); fscanf(fp,"%lld %s %s %d%d%d%d%d%d%d",&p1->xuehao,p1->xingming,p1->xingbie,&p1->nianji,&p1->banji,&p1->yuwen,&p1->shuxue,&p1->yingyu,&p1->lizong,&p1->zongfen); printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); p2->next=p1; p2=p1; } fclose(fp); p1->next=NULL; while(1) { system("clear"); //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ long long m; printf("%s
"," "); scanf("%lld",&m); p2=head; p1=head->next; while(p1->xuehao!=m && p1->next!=NULL) { p2=p1; p1=p1->next; } if(p1->xuehao==m) { p2->next=p1->next; free(p1); } else { printf("%s
"," "); } if((fp=fopen("grade.txt","w"))==NULL) { printf("%s
"," "); } printf("%s\t"," "); printf("%s\t\t"," "); printf("%s\t\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t
"," "); p1=head->next; while(p1) { if(p1->next) { fprintf(fp,"%lld %s %s %d %d %d %d %d %d %d
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); p1=p1->next; } else { fprintf(fp,"%lld %s %s %d %d %d %d %d %d %d",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); p1=p1->next; } } fclose(fp); printf("%s
"," "); printf("%s
"," 0 , "); scanf("%d",&k); system("clear"); if(k==0) { p1=head; while(p1!=NULL) { p3=p1->next; free(p1); p1=p3; } break; } } } //############################################################################################### void xuehaopaixu(Student1 *p,int m); void xingmingpaixu(Student1 *p,int m); void yuwenpaixu(Student1 *p,int m); void shuxuepaixu(Student1 *p,int m); void yingyupaixu(Student1 *p,int m); void lizongpaixu(Student1 *p,int m); void zongfenpaixu(Student1 *p,int m); Student1 temp; void paixu() {// FILE *fp; int i,k=0; Student1 a[100]; if((fp=fopen("grade.txt","r"))==NULL) { printf("%s
"," "); } //printf("###################################################
"); while(!feof(fp)) { fscanf(fp,"%lld %s %s %d%d%d%d%d%d%d",&a[k].xuehao,a[k].xingming,a[k].xingbie,&a[k].nianji,&a[k].banji,&a[k].yuwen,&a[k].shuxue,&a[k].yingyu,&a[k].lizong,&a[k].zongfen); printf("%lld %s %s %d %d %d %d %d %d %d
",a[k].xuehao,a[k].xingming,a[k].xingbie,a[k].nianji,a[k].banji,a[k].yuwen,a[k].shuxue,a[k].yingyu,a[k].lizong,a[k].zongfen); k++; } fclose(fp); //printf("#################################################%d
",k); while(1) { //system("clear"); i=0; printf("%s
"," "); printf("%s
","1. 1"); printf("%s
","2. (ASCII ) 2"); printf("%s
","3. 3"); printf("%s
","4. 4"); printf("%s
","5. 5"); printf("%s
","6. 6"); printf("%s
","7. 7"); scanf("%d",&i); system("clear"); switch(i) { case 1:xuehaopaixu(a,k);break; case 2:xingmingpaixu(a,k);break; case 3:yuwenpaixu(a,k);break; case 4:shuxuepaixu(a,k);break; case 5:yingyupaixu(a,k);break; case 6:lizongpaixu(a,k);break; case 7:zongfenpaixu(a,k);break; default:printf("%s
"," "); } printf("%s\t"," "); printf("%s\t\t"," "); printf("%s\t\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t
"," "); for(i=0;ip[j].xuehao) { temp=p[i]; p[i]=p[j]; p[j]=temp; } } void xingmingpaixu(Student1 *p,int m) { int i,j; for(i=0;ip[j].yuwen) { temp=p[i]; p[i]=p[j]; p[j]=temp; } } void shuxuepaixu(Student1 *p,int m) { int i,j; for(i=0;ip[j].shuxue) { temp=p[i]; p[i]=p[j]; p[j]=temp; } } void yingyupaixu(Student1 *p,int m) { int i,j; for(i=0;ip[j].yingyu) { temp=p[i]; p[i]=p[j]; p[j]=temp; } } void lizongpaixu(Student1 *p,int m) { int i,j; for(i=0;ip[j].lizong) { temp=p[i]; p[i]=p[j]; p[j]=temp; } } void zongfenpaixu(Student1 *p,int m) { int i,j; for(i=0;ip[j].zongfen) { temp=p[i]; p[i]=p[j]; p[j]=temp; } } //############################################################################################### void xingbieshaixuan(Student1 *p); void banjishaixuan(Student1 *p); void chengjishaixuan(Student1 *p); void shaixuan() { int i; FILE *fp; if((fp=fopen("grade.txt","r"))==NULL) { printf("%s
"," "); } Student1 *p1,*p2,*p3,*head; p2=head=(Student1 *)malloc(LEN);//head head->next=NULL; while(!feof(fp)) { p1=(Student1 *)malloc(LEN); fscanf(fp,"%lld %s %s %d%d%d%d%d%d%d",&p1->xuehao,p1->xingming,p1->xingbie,&p1->nianji,&p1->banji,&p1->yuwen,&p1->shuxue,&p1->yingyu,&p1->lizong,&p1->zongfen); //printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); p2->next=p1; p2=p1; } fclose(fp); p1->next=NULL; while(1) { system("clear"); printf("%s
"," "); printf("%s
","1. 1"); printf("%s
","2. 2"); printf("%s
","3. 3"); scanf("%d",&i); system("clear"); switch(i) { case 1:xingbieshaixuan(head);break; case 2:banjishaixuan(head);break; case 3:chengjishaixuan(head);break; default:printf("%s
"," "); } printf("%s
"," 0 , "); scanf("%d",&i); system("clear"); if(i==0) { p1=head; while(p1!=NULL) { p3=p1->next; free(p1); p1=p3; } break; } } } void xingbieshaixuan(Student1 *p) {// int i=2,n=0; long long m; Student1 *p1,*p2,*p3,*head; while(i!=0) { p1=p->next; printf("%s
"," 0, 1"); scanf("%d",&i); printf("%s\t"," "); printf("%s\t\t"," "); printf("%s\t\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t
"," "); if(i==0) { while(p1) { if(strcmp(p1->xingbie," ")==0 || strcmp(p1->xingbie,"m")==0) { printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); } p1=p1->next; } } else if(i==1) { while(p1) { if(strcmp(p1->xingbie," ")==0 || strcmp(p1->xingbie,"f")==0) { printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); } p1=p1->next; } } else { printf("%s
"," "); } printf("%s
"," 0 , "); scanf("%d",&i); } } void banjishaixuan(Student1 *p) { int i=2,n=0,s,t; long long m; Student1 *p1,*p2,*p3,*head; while(i!=0) { p1=p->next; printf("%s
"," "); scanf("%d%d",&s,&t); printf("%s\t"," "); printf("%s\t\t"," "); printf("%s\t\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t
"," "); while(p1!=NULL) { if(p1->nianji==s && p1->banji==t) { printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); } p1=p1->next; } printf("%s
"," 0 , "); scanf("%d",&i); } } void chengjishaixuan(Student1 *p) { int i=2,n=0,g; long long m; Student1 *p1,*p2,*p3,*head; while(i!=0) { p1=p->next; printf("%s
","1. 90 1"); printf("%s
","2. 90 2"); printf("%s
","3. 90 3"); printf("%s
","4. 180 4"); printf("%s
","5. 450 5"); printf("%s
","6. 135 ( 135 ) 6"); printf("%s
","7. 135 ( 135 ) 7"); printf("%s
","8. 135 ( 135 ) 8"); printf("%s
","9. 270 ( 270 ) 9"); printf("%s
","10. 675 ( 675 ) 10"); scanf("%d",&i); system("clear"); printf("%s\t"," "); printf("%s\t\t"," "); printf("%s\t\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t
"," "); if(i==1) { n=0; while(p1) { if(p1->yuwen<90) { n++; printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); } p1=p1->next; } if(n==0) { printf("%s
"," 90 "); } } else if(i==2) { n=0; while(p1!=NULL) { if(p1->shuxue<90) { i++; printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); } p1=p1->next; } if(n==0) { printf("%s
"," 90 "); } } else if(i==3) { n=0; while(p1!=NULL) { if(p1->yingyu<90) { n++; printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); } p1=p1->next; } if(n==0) { printf("%s
"," 90 "); } } else if(i==4) { n=0; while(p1!=NULL) { if(p1->lizong<180) { printf("%-15lld%-12s%-5s%-5d%-5d%-7d%-7d%-7d%-7d%-7d
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); } p1=p1->next; } if(n==0) { printf("%s
"," 180 "); } } else if(i==5) { n=0; while(p1!=NULL) { if(p1->zongfen<450) { n++; printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); } p1=p1->next; } if(n==0) { printf("%s
"," 450 "); } } else if(i==6) { n=0; while(p1!=NULL) { if(p1->yuwen>=135) { n++; printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); } p1=p1->next; } if(n==0) { printf("%s
"," 135 ( 135 ) "); } } else if(i==7) { n=0; while(p1!=NULL) { if(p1->shuxue>=135) { n++; printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); } p1=p1->next; } if(n==0) { printf("%s
"," 135 ( 135 ) "); } } else if(i==8) { n=0; while(p1!=NULL) { if(p1->yingyu>=135) { n++; printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); } p1=p1->next; } if(n==0) { printf("%s
"," 135 ( 135 ) "); } } else if(i==9) { n=0; while(p1!=NULL) { if(p1->lizong>=270) { n++; printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); } p1=p1->next; } if(n==0) { printf("%s
"," 270 ( 270 ) "); } } else if(i==10) { n=0; while(p1!=NULL) { if(p1->zongfen>=675) { n++; printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); } p1=p1->next; } if(n==0) { printf("%s
"," 675 ( 675 ) "); } } else { printf("%s
"," "); } printf("%s
"," 0 , "); scanf("%d",&i); } } //############################################################################################### void dayin() {// system("clear"); printf("%s\t"," "); printf("%s\t\t"," "); printf("%s\t\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t"," "); printf("%s\t
"," "); FILE *fp; if((fp=fopen("grade.txt","r+"))==NULL) { fp=fopen("grade.txt","w+"); } Student1 *p1,*p2,*p3,*head; int i=0,n=0,k; p2=head=(Student1 *)malloc(LEN);//head head->next=NULL; while(!feof(fp)) { p1=(Student1 *)malloc(LEN); fscanf(fp,"%lld %s %s %d%d%d%d%d%d%d",&p1->xuehao,p1->xingming,p1->xingbie,&p1->nianji,&p1->banji,&p1->yuwen,&p1->shuxue,&p1->yingyu,&p1->lizong,&p1->zongfen); printf("%lld\t%s\t\t%s\t\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t
",p1->xuehao,p1->xingming,p1->xingbie,p1->nianji,p1->banji,p1->yuwen,p1->shuxue,p1->yingyu,p1->lizong,p1->zongfen); p2->next=p1; p2=p1; } fclose(fp); p1->next=NULL; } //############################################################################################### void qingkong() {// FILE *fp; if((fp=fopen("grade.txt","w"))==NULL) { printf("%s
"," "); } fclose(fp); } //############################################################################################### int main() { int i=0; while(i!=-1) { system("clear"); printf("%s
"," "); printf("%s
","1. 1"); printf("%s
","2. 2"); printf("%s
","3. 3"); printf("%s
","4. 4"); printf("%s
","5. 5"); printf("%s
","6. 6"); printf("%s
","7. 7"); printf("%s
","8. 8"); printf("%s
","9. -1 "); printf("%s
"," 1: Enter "); printf("%s
"," 2: , "); printf("%s
"," 3: , "); void chazhao(); void xiugai(); void tianjia(); void shanchu(); void paixu(); void shaixuan(); void dayin(); void qingkong(); scanf("%d",&i); if(i==-1) { break; } switch(i) { case 1:chazhao();break; case 2:xiugai();break; case 3:tianjia();break; case 4:shanchu();break; case 5:paixu();break; case 6:shaixuan();break; case 7:dayin();break; case 8:qingkong();break; default:printf("%s
"," , "); } printf("%s
"," -1 , "); scanf("%d",&i); } return 0; }

사용 한 파일 내용
이사 녀 1 1 123 117 138 256 634
13 왕 오 남 1 2 107 127 126 254 614
조 육 녀 3 1 115 130 131 226 602
마 칠 남 3 2 135 85 124 202 546
16 장 남 2 94 123 119 287 623
17 이사 사 남 2 2 116 107 96 241 560
왕 오 녀 3 103 90 141 233 567
19 조 육 육 남 1 2 99 131 126 253 609
20 말 칠 칠 남 1 4 107 135 116 298 656
주석.
이 프로그램 은 정렬 기능 을 제외 하고 다른 기능 은 모두 간단 한 링크 로 이 루어 집 니 다. 정렬 기능 은 배열 에 대한 조작 을 사용 합 니 다.

좋은 웹페이지 즐겨찾기