diff --git a/课程设计(final).cpp b/课程设计(final)(final).cpp similarity index 82% rename from 课程设计(final).cpp rename to 课程设计(final)(final).cpp index 2e8ddad..7c8f05f 100644 --- a/课程设计(final).cpp +++ b/课程设计(final)(final).cpp @@ -12,28 +12,28 @@ typedef struct exam_system // struct exam_system *next; }EXAM; //ÀàÐÍÃû×Ô¶¨Òå +void Createlink(); //´´½¨Á´±íº¯Êý +void exam(); //¿¼ÊÔ³õʼ½çÃ溯Êý void management(); //ÌâÄ¿¹ÜÀíº¯Êý -void add(); //Ìí¼ÓÌâÄ¿º¯Êý -void show(); //±éÀúÌâ¿âº¯Êý void preservation(); //±£´æÎĵµº¯Êý -void change(); //ÐÞ¸ÄÌâÄ¿º¯Êý -void exam(); //¿¼ÊÔ³õʼ½çÃ溯Êý -void link(); //´´½¨Á´±íº¯Êý +void experience(); //±éÀúÌâ¿âº¯Êý +void add(); //Ìí¼ÓÌâÄ¿º¯Êý +void modification(); //ÐÞ¸ÄÌâÄ¿º¯Êý void Answer(); //´ðÌ⺯Êý +FILE *fp; int sum; //ÌâÄ¿×ÜÊý struct exam_system *p1,*p2,*head; -FILE *fp; int main() { - link(); + Createlink(); system("color 75"); //×Ô¶¨Òåbackground exam(); return 0; } -void link() //´´½¨Á´±í +void Createlink() //´´½¨Á´±í { head=(EXAM *)malloc(sizeof(EXAM)); //´´½¨Í·½Úµã,²¢¸øÓèÒ»¸ö¶¯Ì¬ÄÚ´æ p2=p1=head; //Á¬Ðø¸³Öµ @@ -102,8 +102,8 @@ void management() // switch(x) { case 1:add();management();break; - case 2:show();management();break; - case 3:change();management();break; + case 2:experience();management();break; + case 3:modification();management();break; case 4:;exam();break; default :printf("ÊäÈëÓÐÎó£¡\n");break; } @@ -124,7 +124,7 @@ void preservation() // getch(); } -void show() //±éÀúÌâ¿âº¯Êý +void experience() //±éÀúÌâ¿âº¯Êý { int c,i; EXAM *p=NULL; @@ -160,16 +160,16 @@ else } } -void add() //ÌâÄ¿Ìí¼Óº¯Êý +void add() //ÌâÄ¿Ìí¼Óº¯Êý { - int x,i; + int n,i; system("cls"); printf("\t\t**************»¶Ó­À´µ½ÌâÄ¿¹ÜÀíϵͳ****************\n"); do { p1=(EXAM *)malloc(sizeof(EXAM)); - p2->next=p1; //ÏàÁ¬p1¡¢p2 - p2=p1; //Ö¸ÏòÏàͬ + p2->next=p1; //ÏàÁ¬p1¡¢p2 + p2=p1; //Ö¸ÏòÏàͬ printf("ÇëÊäÈëµÚ%d¸öÌâÄ¿£º",sum+1); scanf("%s",p1->problem); printf("ÇëÊäÈ뱸ѡ´ð°¸£º\n"); @@ -183,24 +183,24 @@ void add() // scanf("%c",&p1->right ); sum+=1; printf("\n"); - printf("\tÊÇ·ñ¼ÌÐøÌí¼Ó\n\t1.¼ÌÐø\n\t2.Í˳ö\nÇëÑ¡Ôñ£º"); - scanf("%d",&x); - if(x==2) + printf("\n¼ÌÐøÌí¼ÓÏÂÒ»Ì⣿\n1.ÊÇ\n2.·ñ\nÄãµÄÑ¡ÔñÊÇ£º"); + scanf("%d",&n); + if(n==2) { p2->next=NULL; break; } system("cls"); - }while(x==1); + }while(n==1); preservation(); } -void change() //ÐÞ¸ÄÌâÄ¿º¯Êý +void modification() //ÐÞ¸ÄÌâÄ¿º¯Êý { int i,num; EXAM *p1=NULL; EXAM *p2=NULL; - show(); + experience(); if(sum>=1) { p1=(EXAM *)malloc(sizeof(EXAM)); //ΪP1·ÖÅäÒ»¸ö¶¯Ì¬ÄÚ´æ @@ -208,21 +208,19 @@ void change() // printf("ÇëÑ¡ÔñÐ޸ĵÄÌâÄ¿ÐòºÅ£º"); scanf("%d",&num); for(i=0;inext; - } //´Ëʱp2ÖÕÓÚÒÀ´ÎŲµ½num-1´¦ + p2=p2->next; //´Ëʱp2ÖÕÓÚÒÀ´ÎŲµ½num-1´¦ printf("ÇëÊäÈëÌâÄ¿£º"); scanf("%s",p1->problem); printf("ÇëÊäÈ뱸ѡ´ð°¸£º\n"); for(i=0;i<4;) { - printf("%c:",i+'A'); + printf("%c)",i+'A'); scanf("%s",p1->answer[i++] ); } printf("ÊäÈëÕýÈ·´ð°¸£º"); p1->right=getchar(); scanf("%c",&p1->right); - p1->next=p2->next->next; //´Ëʱнڵ㽫´úÌæÔ­½Úµã + p1->next=p2->next->next; //½ÚµãÌæ»»Á¬½Ó³É¹¦ p2->next=p1; //p1¡¢p2Á¬½Ó p1=NULL; p2=NULL; //×îºó¶¼ÖÃΪĩβ @@ -234,11 +232,14 @@ void Answer() // { int i,j,c; int n; + char write; int score=0; EXAM *p=NULL; printf("×£Ä㿼ÊÔ˳Àû£¡£¡\n"); system("cls"); - if(sum>0) + if(sum=0) + printf("Ìâ¿âÖÐûÓÐÌâÄ¿!\n"); + else { i=0; p=head; @@ -251,24 +252,24 @@ void Answer() // c=0; while(c<4) { - printf("%c:",c+'A'); + printf("%c)",c+'A'); printf("%s\n",p->answer[c++] ); } printf("ÇëÊäÈëÄãµÄ´ð°¸£º"); - p->input=getchar(); - scanf("%c",&p->input); - if(p->right==p->input) + getchar(); + scanf("%c",&write); + if(p->right==write) { - printf("\n¹§Ï²£¡£¡ÄãµÄ´ð°¸ÊÇ %c £¬ÕýÈ·´ð°¸ÊÇ %c ",p->input,p->right); + printf("\n¹§Ï²£¡£¡ÄãµÄ´ð°¸ÊÇ %c £¬ÕýÈ·´ð°¸ÊÇ %c ",write,p->right); score+=1; } else { - printf("\nÌ«¿ÉϧÁË~ÄãµÄ´ð°¸ÊÇ %c £¬ÕýÈ·´ð°¸ÊÇ %c ",p->input,p->right); + printf("\nÌ«¿ÉϧÁË~ÄãµÄ´ð°¸ÊÇ %c £¬ÕýÈ·´ð°¸ÊÇ %c ",write,p->right); } i=i+1; printf("\n----------------------------------------------------------\n"); - if(i==n) + if(i==n) //Âú×ãÓû§ÒªÇó break; }while(p->next!=NULL); printf("¿¼ÊÔ½áÊø!\n"); @@ -276,8 +277,6 @@ void Answer() // getch(); ; } - else - printf("Ìâ¿âÖÐûÓÐÌâÄ¿!\n"); printf("°´ÈÎÒâ¼ü¼ÌÐø£¡\n"); getchar(); } diff --git a/课程设计(final)(final).exe b/课程设计(final)(final).exe new file mode 100644 index 0000000..d75fc42 Binary files /dev/null and b/课程设计(final)(final).exe differ