From a020f7c8bec89e7143e9f7f77f99d529b4a9bbc9 Mon Sep 17 00:00:00 2001 From: ljc990211 <2104054783@qq.com> Date: Fri, 11 Jan 2019 21:55:08 +0800 Subject: [PATCH] third commit --- 附件.txt | 735 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 735 insertions(+) create mode 100644 附件.txt diff --git a/附件.txt b/附件.txt new file mode 100644 index 0000000..e6f215f --- /dev/null +++ b/附件.txt @@ -0,0 +1,735 @@ +#include +#include +#include +typedef struct + { + char name[20]; //ѧÉúÐÕÃû + char xuehao[20]; //ѧÉúѧºÅ + char phone[20]; //ѧÉúÊÖ»úºÅ + char qq[20]; //ѧÉúQQºÅ + int score[3]; //ѧÉúµÄÈýÃſγɼ¨ + int sum; //ѧÉúÈýÃſγɼ¨µÄ×ÜºÍ + }STU; +int addstu(); //ÔöÌíѧÉúÐÅÏ¢ +void stupaixu(); //½«Ñ§ÉúÐÅÏ¢°´·ÖÊýÓɸߵ½µÍÏÔʾ +int xhcz(); //ÓÃѧºÅ½øÐвéÕÒ +int namecz(); //ÓÃÐÕÃû²éѯ +int xxxg(); //ËÑË÷ѧºÅ£¬²¢¶Ô¸ÃÉúµÄÐÅÏ¢½øÐÐÐÞ¸Ä +int shanchu(); //ËÑË÷ѧºÅ£¬É¾³ý¸ÃÉúËùÓÐÐÅÏ¢ +void fsdxs(); //·ÖÊý¶ÎÏÔʾ ³É¼¨ +int menu(); //²Ëµ¥º¯Êý +int stdk(); //ѧÉú¶Ë¿Ú½çÃæ +int tedk(); //½Ìʦ¶Ë¿Ú½çÃæ + +int main() +{ + system("color f1"); //°üº¬ÓÚÍ·Îļþ Á½¸ö16½øÖƵÄÊýÀ´»»ÑÕÉ«£¬µÚÒ»¸öÊDZ³¾°ÑÕÉ«£¬µÚ¶þ¸öÊÇ×ÖÌåÑÕÉ« + menu(); //µ÷Óò˵¥½çÃ溯Êý + for(;;) + { + switch(menu()) //½«²Ëµ¥½çÃæ Óû§ÊäÈëµÄÐèÇó·µ»ØÖµ½øÐÐÑ¡Ôñ + { + case 1: + printf("\n\t\tÕýÔÚ½øÈëѧÉú½çÃæ\n\n\t\t"); + system("cls"); //ÏÈÇåÆÁ + stdk(); //ÔÙµ÷Óú¯Êý£¬ÏÔʾ½çÃæ + system("pause"); //½«ÏÔʾµÄ½çÃæ¹Ì¶¨×¡ + break; + case 2: + printf("\n\t\tÕýÔÚ½øÈë½Ìʦ½çÃæ\n\n\t\t"); + system("cls"); //ÏÈÇåÆÁ + tedk(); //ÔÙµ÷Óú¯Êý£¬ÏÔʾ½çÃæ + system("pause"); //½«ÏÔʾµÄ½çÃæ¹Ì¶¨×¡ + break; + case 0: + printf("\n\t\t»¶Ó­ÔÙ´ÎʹÓã¡\n\n\t\t"); + system("pause"); + exit(0); + } + } + return 0; +} + +int menu() //²Ëµ¥º¯Êý +{ + char xuanze; //¶¨ÒåÒ»¸ö ×Ö·ûÐÍ µÄ"Ñ¡Ôñ"£¬ ÓÃÓÚ½ÓÊÕÓû§µÄÐèÇó + int xz; //¶¨ÒåÒ»¸ö ÕûÐÍ µÄ"Ñ¡Ôñ"£¬ ×÷Ϊ ×Ö·ûÐÍÑ¡ÔñµÄ ·µ»ØÖµ + do + { + system("cls"); //ÇåÆÁ + printf("\n\t\t************ºþÄϹ¤Òµ´óѧÐÅÏ¢¹ÜÀíϵͳ************\n"); + printf("\t\t*©°-------------------------------------------©´ *\n"); + printf("\t\t*©¦ ÇëÎÊÄúµÄÉí·ÝÊÇ£º ©¦ *\n"); + printf("\t\t*©¦ 1.ѧÉú ©¦ *\n"); + printf("\t\t*©¦ 2.½Ìʦ ©¦ *\n"); + printf("\t\t*©¦ 0.Í˳ö ©¦ *\n"); + printf("\t\t*©¸-------------------------------------------©¼ *\n"); + printf("\t\t************************************************\n"); + printf("\t\tÇëÄúÑ¡Ôñ(0-2):"); + fflush(stdin); //·ÀÖ¹Óû§Ò»´ÎÐÔÊäÈë¶à¸ö×Ö·û + scanf("%c", &xuanze); //²é¿´Óû§µÄÉí·Ý£¬½øÈëÏÂÒ»½çÃæ + }while(xuanze<'0' || xuanze>'2'); //¼ì²éÊäÈëÊÇ·ñ·ûºÏ¹æ·¶ + xz = xuanze-'0'; //½«×Ö·ûÐ͵ÄÑ¡Ôñת»»³ÉÕûÐÍ + switch(xz) //½«ÕûÐÍ·µ»ØÖµ½øÐÐ "Ñ¡Ôñ" + { + case 1: + printf("\n\t\tÕýÔÚ½øÈëѧÉú½çÃæ\n\n\t\t"); + system("cls"); //ÏÈÇåÆÁ + stdk(); //ÔÙµ÷Óú¯Êý£¬ÏÔʾ½çÃæ + system("pause"); //½«ÏÔʾµÄ½çÃæ¹Ì¶¨×¡ + break; + case 2: + printf("\n\t\tÕýÔÚ½øÈë½Ìʦ½çÃæ\n\n\t\t"); + system("cls"); //ÏÈÇåÆÁ + tedk(); //ÔÙµ÷Óú¯Êý£¬ÏÔʾ½çÃæ + system("pause"); //½«ÏÔʾµÄ½çÃæ¹Ì¶¨×¡ + break; + case 0: + printf("\n\t\t»¶Ó­ÔÙ´ÎʹÓã¡\n\n\t\t"); + system("pause"); + exit(0); + } +} + +int addstu() //ÔöÌíѧÉúÐÅÏ¢ +{ + FILE *fp1=NULL, *fp=NULL; //¶¨ÒåÁ½¸öÎļþÖ¸Õë + STU st[1000]; //¶¨ÒåÒ»¸öÁãʱ½á¹¹ÌåÊý×飬ÓÃÀ´´æ´¢´ÓÎļþ¶ÁÈëµÄѧÉúÐÅÏ¢ + int n, k=0, q; // n ÓÃÀ´´æ´¢ÐèÒªÌí¼ÓµÄѧÉúÈËÊý + // k ÓÃÀ´¼ÆËãÔ­ÎļþÖеÄѧÉú×ÜÊý + // q ÓÃÀ´×öÑ­»·µÄÕûÐͱäÁ¿ + char names[20]; //¶¨ÒåÁãʱÐÕÃû×Ö·û´®£¬ÓÃÓÚÁãʱ´æ´¢Ñ§ÉúÐÕÃû + char xuehaos[20]; //¶¨ÒåÁãʱѧºÅ×Ö·û´®£¬ÓÃÓÚÁãʱ´æ´¢Ñ§ÉúѧºÅ + if((fp1 = fopen("xsxx.txt","r"))==NULL) + { + printf("\n\t\tError\n\n\t\t"); + exit(0); + } + while(!feof(fp1)) + { + fscanf(fp1,"%s %s %s %s %d %d %d %d",&st[k].name,&st[k].xuehao,&st[k].phone,&st[k].qq,&st[k].score[0], &st[k].score[1],&st[k].score[2],&st[k].sum); + k++; //ÿ¶ÁÈëÒ»¸öѧÉúÐÅÏ¢£¬Ñ§Éú×ÜÊý¼ÓÒ» + } + fclose(fp1); + printf("\n\t\tÇëÊäÈëÒªÔöÌíµÄѧÉúÈËÊý:\n\n\t\t"); + scanf("%d",&n); //¶ÁÈëÐèÒªÌí¼ÓµÄѧÉúÈËÊý + system("cls"); + for(int i=0; ik) // i > k ʱ£¬¼´Õû¸öÎļþËùÓÐѧºÅ¶¼Ã»ÓÐÆ¥ÅäµÄ£¬Ö´Ðд˲½Öè + { + printf("\n\t\t²éÎÞ´ËÈË!\n\n\t\t"); + system("pause"); //ÔÝͣһϣ¬ÈÃÓû§ÖªµÀΪɶ·µ»ØÖ÷½çÃæ + return main(); //·µ»ØÖ÷½çÃæ + } + else // i < k ʱ£¬ËµÃ÷ÓÐÆ¥ÅäµÄÈË£¬ËûʱµÚ i ¸öÈË + { + printf("\n\t\t********************************ѧÉúÐÅÏ¢******************************\n"); + printf("\t\t----------------------------------------------------------------------\n"); + printf("\t\tÐÕÃû:%-16s\tѧºÅ:%-16s\n",st[i].name,st[i].xuehao); + printf("\t\tÊÖ»úºÅ:%-16s\tQQºÅ:%-16s\n",st[i].phone,st[i].qq); + for(int s=0; s<3; s++) + { + printf("\t\t"); + printf("µÚ%d¿ÆÄ¿³É¼¨:%3d",s+1,st[i].score[s]); + } + printf("\n\t\t×Ü·Ö:%d\n",st[i].sum); + printf("\t\t----------------------------------------------------------------------\n"); + printf("\n\t\t"); + system("pause"); //ÏÈÈÃÓû§¿´¹»ÁË£¬È»ºó°´ÈÎÒâ¼ü·µ»Ø + return main(); //·µ»ØÖ÷½çÃæ + } +} + +int xxxg() //ÐÞ¸ÄÐÅÏ¢µÄº¯Êý == "ѧºÅ ÐÞ¸Ä"µÄÆ´Òô +{ + FILE *fp=NULL, *fp2=NULL; //¶¨ÒåÁ½¸öÎļþÖ¸Õë + STU st[1000], tempa; //¶¨ÒåÒ»¸öÁãʱ½á¹¹ÌåÊý×飬һ¸öÁãʱ½á¹¹Ìå + int n, i, j, k=0, x; // kÓÃÓÚ¼ÆÊý + int km1, km2, km3, q, r; //¿ÆÄ¿1£¬¿ÆÄ¿2£¬¿ÆÄ¿3£¬Á½¸öÓÃÓÚÑ­»·µÄÕûÐͱäÁ¿ + char xuehaos[20], xiugais[20]; //¶¨ÒåÒ»¸öÁãʱ ѧºÅ×Ö·û´®£¬Ò»¸ö "ÐÞ¸Ä"×Ö·û´® + char xuanze; //×Ö·ûÐÍ Ñ¡Ôñ + if((fp = fopen("xsxx.txt","r"))==NULL) + { + printf("Error\n"); + exit(0); + } + while(!feof(fp)) + { + fscanf(fp,"%s %s %s %s %d %d %d %d",&st[k].name,&st[k].xuehao,&st[k].phone,&st[k].qq,&st[k].score[0], &st[k].score[1],&st[k].score[2],&st[k].sum); + k++; //ÿ¶ÁÈëÒ»¸öѧÉúÐÅÏ¢×ÜÊý¼ÓÒ» + } + fclose(fp); + printf("\n\t\tÇëÊäÈëÐèÒªÐÞ¸ÄÐÅÏ¢µÄѧÉúѧºÅ:\n\n\t\t"); + scanf("%s", &xuehaos); //¶ÁÈëÓû§ÏëÒªÐÞ¸ÄÈ˵ÄѧºÅ + for(i=0; i<=k; i++) //Ñ­»·²éÕÒÕâ¸öÈË + { + if(strcmp(xuehaos,st[i].xuehao)==0) + break; + } + if(i>k) + { + printf("\n\t\t²éÎÞ´ËÈË!\n\n\t\t"); + system("pause"); + return main(); + } + else + { + printf("\n\t\t********************************ѧÉúÐÅÏ¢******************************\n"); + printf("\t\t----------------------------------------------------------------------\n"); + printf("\t\tÐÕÃû:%-16s\tѧºÅ:%-16s\n",st[i].name,st[i].xuehao); + printf("\t\tÊÖ»úºÅ:%-16s\tQQºÅ:%-16s\n",st[i].phone,st[i].qq); + for(int s=0; s<3; s++) + { + printf("\t\t"); + printf("µÚ%d¿ÆÄ¿³É¼¨:%3d",s+1,st[i].score[s]); + } + printf("\n\t\t×Ü·Ö:%d\n",st[i].sum); + printf("\t\t----------------------------------------------------------------------\n"); + printf("\n\t\t************************************************\n"); + printf("\t\t*©°-------------------------------------------©´ *\n"); + printf("\t\t*©¦ ÇëÑ¡ÔñÄúÐèÒªµÄ·þÎñ: ©¦ *\n"); + printf("\t\t*©¦ 1.ÐÞ¸ÄÐÕÃû: ©¦ *\n"); + printf("\t\t*©¦ 2.ÐÞ¸ÄѧºÅ: ©¦ *\n"); + printf("\t\t*©¦ 3.ÐÞ¸ÄÊÖ»úºÅ: ©¦ *\n"); + printf("\t\t*©¦ 4.ÐÞ¸ÄQQºÅ: ©¦ *\n"); + printf("\t\t*©¦ 5.Ð޸ijɼ¨: ©¦ *\n"); + printf("\t\t*©¦ 0.·µ»ØÉÏÒ»½çÃæ ©¦ *\n"); + printf("\t\t*©¸-------------------------------------------©¼ *\n"); + printf("\t\t************************************************\n"); + printf("\n\t\tÇëÊäÈëÐèÒªÐ޸ĵÄÐÅÏ¢:\n\t\t"); + fflush(stdin); + scanf("%c", &xuanze); + x = xuanze - '0'; + switch(x) + { + case 1: + printf("\n\t\tÇëÊäÈëеÄÐÕÃû:\n\n\t\t"); + scanf("%s", &xiugais); + strcpy(st[i].name, xiugais); + printf("\n\t\tÐ޸ijɹ¦!\n\n\t\t"); + system("pause"); + break; + case 2: + printf("\n\t\tÇëÊäÈëеÄѧºÅ:\n\n\t\t"); + scanf("%s", &xiugais); + for(q=0; q<=k; q++) + { + if(strcmp(xiugais,st[q].xuehao)==0) //ÅжÏÊÇ·ñÓëÎļþÖеÄѧºÅ³åÍ» + { //½«ÐÂѧºÅÓëÎļþÖÐËùÓÐѧºÅ½øÐбȶԣ¬Èç¹ûÖظ´Á˾Ͳ»Äܳɹ¦ÐÞ¸Ä + printf("\n\t\t¸ÃѧºÅÒÑ´æÔÚ£¬ÎÞ·¨ÐÞ¸Ä!!!\n\n\t\t"); + printf("\n\t\t½«·µ»ØÉÏÒ»½çÃæ\n\n\t\t"); + system("pause"); + system("cls"); + return main(); //·µ»ØÖ÷½çÃæ + } + } + strcpy(st[i].xuehao, xiugais); //Èç¹û²»³åÍ»£¬¾ÍÐÞ¸Ä + printf("\n\t\tÐ޸ijɹ¦!\n\n\t\t"); + system("pause"); + break; + case 3: + printf("\n\t\tÇëÊäÈëÐÂÊÖ»úºÅ:\n\n\t\t"); + scanf("%s", &xiugais); + strcpy(st[i].phone, xiugais); + printf("\n\t\tÐ޸ijɹ¦!\n\n\t\t"); + system("pause"); + break; + case 4: + printf("\n\t\tÇëÊäÈëеÄQQºÅ:\n\n\t\t"); + scanf("%s", &xiugais); + strcpy(st[i].qq, xiugais); + printf("\n\t\tÐ޸ijɹ¦!\n\n\t\t"); + system("pause"); + break; + case 5: + printf("\n\t\tÇëÊäÈëеÄÈýÃÅ¿ÆÄ¿³É¼¨:\n\n\t\t"); + scanf("%d %d %d", &km1, &km2, &km3); //½«ÐµÄÈýÃÅ¿ÆÄ¿µÄ³É¼¨¸³¸øµÚ i ¸öÈ˵ijɼ¨ÀïÃæ + st[i].score[0] = km1; + st[i].score[1] = km2; + st[i].score[2] = km3; + st[i].sum = km1 + km2 + km3; + printf("\n\t\tÐ޸ijɹ¦!\n\n\t\t"); + system("pause"); + break; + } + system("cls"); //³É¹¦ÐÞ¸ÄÁËÖ®ºó£¬½«Õâ¸öÈ˵ÄÐÅÏ¢ÏÔʾ³öÀ´ + printf("\n\t\t********************************ѧÉúÐÅÏ¢******************************\n"); + printf("\t\t----------------------------------------------------------------------\n"); + printf("\t\tÐÕÃû:%-16s\tѧºÅ:%-16s\n",st[i].name,st[i].xuehao); + printf("\t\tÊÖ»úºÅ:%-16s\tQQºÅ:%-16s\n",st[i].phone,st[i].qq); + for(int s=0; s<3; s++) + { + printf("\t\t"); + printf("µÚ%d¿ÆÄ¿³É¼¨:%3d",s+1,st[i].score[s]); + } + printf("\n\t\t×Ü·Ö:%d\n",st[i].sum); + printf("\t\t----------------------------------------------------------------------\n"); + printf("\n\t\t"); + } + if((fp2 = fopen("xsxx.txt","w"))==NULL) + { + printf("\n\t\tError\n\n\t\t"); + exit(0); + } + for(int o=0; ok) //Èç¹û i > k ,˵Ã÷Õû¸öÎļþËùÓеÄѧÉúÐÅÏ¢¶Ô±ÈÍ꣬¶¼Ã»ÓÐÒ»¸öÄÜÆ¥Å䣬ִÐд˲½Öè + { + printf("\n\t\t²éÎÞ´ËÈË!\n\n\t\t"); + system("pause"); //ÈÃÓû§ÖªµÀΪɶ²»ÄÜɾ³ý + return main(); + } + else //´Ë²½ÖèÊǽ«É¾³ýÐÅÏ¢ºóµÄÁãʱ½á¹¹ÌåÊäÈëÖØÐÂÈ«²¿Ð´ÈëÎļþ + { + printf("\n\t\tɾ³ý³É¹¦!\n\n\t\t"); + if((fp = fopen("xsxx.txt","w"))==NULL) //ÒÔ "w" µÄ·½Ê½´ò¿ª£¬ÍêÈ«¸²¸ÇÔ­Îļþ + { + printf("\n\t\tError\n\n\t\t"); + exit(0); + } + for(int o=0; o=90) + { + printf("\t\tÐÕÃû:%-16s\tƽ¾ù·Ö:%5.2f\n", st[i].name, st[i].sum/3.0); + s = 1; //Èç¹ûÖ´Ðд˲½Ö裬¾Í´ò¿ª¿ª¹Ø£¬¾Í²»»áÊä³ö "´Ë·ÖÊý¶ÎÎÞÈË"µÄÓï¾äÁË + } + ave = 0; + } + if(s==0) //ÅжϿª¹ØÊÇ·ñ´ò¿ª£¬Èç¹ûδ´ò¿ª£¬¾ÍÖ´Ðд˲½Öè + printf("\t\t´Ë·ÖÊý¶ÎûÓÐÈË!\n"); + s = 0; //ÿһ´Î¶¼ÒªÖØÖÿª¹Ø + printf("\t\t----------------------------------------------------------------------\n"); + printf("\t\tƽ¾ù·Ö80~90µÄÈËÊÇ:\n"); + for(i=0; i=80 && ave<90) + { + printf("\t\tÐÕÃû:%-16s\tƽ¾ù·Ö:%5.2f\n", st[i].name, st[i].sum/3.0); + s = 1; //Èç¹ûÖ´Ðд˲½Ö裬¾Í´ò¿ª¿ª¹Ø£¬¾Í²»»áÊä³ö "´Ë·ÖÊý¶ÎÎÞÈË"µÄÓï¾äÁË + } + ave = 0; + } + if(s==0) //ÅжϿª¹ØÊÇ·ñ´ò¿ª£¬Èç¹ûδ´ò¿ª£¬¾ÍÖ´Ðд˲½Öè + printf("\t\t´Ë·ÖÊý¶ÎûÓÐÈË!\n"); + s = 0; //ÿһ´Î¶¼ÒªÖØÖÿª¹Ø + printf("\t\t----------------------------------------------------------------------\n"); + printf("\t\tƽ¾ù·Ö70~80µÄÈËÊÇ:\n"); + for(i=0; i=70 && ave<80) + { + printf("\t\tÐÕÃû:%-16s\tƽ¾ù·Ö:%5.2f\n", st[i].name, st[i].sum/3.0); + s = 1; //Èç¹ûÖ´Ðд˲½Ö裬¾Í´ò¿ª¿ª¹Ø£¬¾Í²»»áÊä³ö "´Ë·ÖÊý¶ÎÎÞÈË"µÄÓï¾äÁË + } + ave = 0; + } + if(s==0) //ÅжϿª¹ØÊÇ·ñ´ò¿ª£¬Èç¹ûδ´ò¿ª£¬¾ÍÖ´Ðд˲½Öè + printf("\t\t´Ë·ÖÊý¶ÎûÓÐÈË!\n"); + s = 0; //ÿһ´Î¶¼ÒªÖØÖÿª¹Ø + printf("\t\t----------------------------------------------------------------------\n"); + printf("\t\tƽ¾ù·Ö60~70µÄÈËÊÇ:\n"); + for(i=0; i=60 && ave<70) + { + printf("\t\tÐÕÃû:%-16s\tƽ¾ù·Ö:%5.2f\n", st[i].name, st[i].sum/3.0); + s = 1; //Èç¹ûÖ´Ðд˲½Ö裬¾Í´ò¿ª¿ª¹Ø£¬¾Í²»»áÊä³ö "´Ë·ÖÊý¶ÎÎÞÈË"µÄÓï¾äÁË + } + ave = 0; + } + if(s==0) //ÅжϿª¹ØÊÇ·ñ´ò¿ª£¬Èç¹ûδ´ò¿ª£¬¾ÍÖ´Ðд˲½Öè + printf("\t\t´Ë·ÖÊý¶ÎûÓÐÈË!\n"); + s = 0; //ÿһ´Î¶¼ÒªÖØÖÿª¹Ø + printf("\t\t----------------------------------------------------------------------\n"); + printf("\t\tƽ¾ù·ÖµÍÓÚ60µÄÈËÊÇ:\n"); + for(i=0; i=0 && ave<60) + { + printf("\t\tÐÕÃû:%-16s\tƽ¾ù·Ö:%5.2f\n", st[i].name, st[i].sum/3.0); + s = 1; //Èç¹ûÖ´Ðд˲½Ö裬¾Í´ò¿ª¿ª¹Ø£¬¾Í²»»áÊä³ö "´Ë·ÖÊý¶ÎÎÞÈË"µÄÓï¾äÁË + } + ave = 0; + } + if(s==0) //ÅжϿª¹ØÊÇ·ñ´ò¿ª£¬Èç¹ûδ´ò¿ª£¬¾ÍÖ´Ðд˲½Öè + printf("\t\t´Ë·ÖÊý¶ÎûÓÐÈË!\n\n\t\t"); + printf("\n\t\t"); +} + +int stdk() //ѧÉú¶Ë¿Ú "st == ѧÉú£¬ dk == ¶Ë¿Ú" +{ + char xuanze; //"Ñ¡Ôñ" + int xz; //"Ñ¡ÔñµÄÕûÐÍ·µ»ØÖµ" + do + { + system("cls"); //ÇåÆÁ + printf("\n\t\t************ºþÄϹ¤Òµ´óѧÐÅÏ¢¹ÜÀíϵͳ************\n"); + printf("\t\t*©°-------------------------------------------©´ *\n"); + printf("\t\t*©¦ ÇëÑ¡ÔñÄúÐèÒªµÄ·þÎñ: ©¦ *\n"); + printf("\t\t*©¦ 1.ÏÔʾËùÓÐѧÉúµÄ³É¼¨ÐÅÏ¢ ©¦ *\n"); + printf("\t\t*©¦ 2.°´·ÖÊý¶ÎÏÔʾ³É¼¨ÐÅÏ¢ ©¦ *\n"); + printf("\t\t*©¦ 3.°´Ñ§ºÅ²éѯ³É¼¨ÐÅÏ¢ ©¦ *\n"); + printf("\t\t*©¦ 4.°´ÐÕÃû²éѯ³É¼¨ÐÅÏ¢ ©¦ *\n"); + printf("\t\t*©¦ 0.·µ»ØÉÏÒ»½çÃæ ©¦ *\n"); + printf("\t\t*©¸-------------------------------------------©¼ *\n"); + printf("\t\t************************************************\n"); + printf("\t\tÇëÄúÑ¡Ôñ(0-4):"); + fflush(stdin); //·ÀÖ¹Óû§Ò»´ÎÐÔÊäÈë¶à¸ö×Ö·û + scanf("%c", &xuanze); //²é¿´Óû§µÄÉí·Ý£¬½øÈëÏÂÒ»½çÃæ + }while(xuanze<'0' || xuanze>'4'); //¼ì²éÊäÈëÊÇ·ñ·ûºÏ¹æ·¶ + xz = xuanze-'0'; //½«×Ö·ûÐÍ"Ñ¡Ôñ"±ä³ÉËüµÄÕûÐÍ·µ»ØÖµ + switch(xz) //½«ÕûÐÍ·µ»ØÖµ½øÐÐ "Ñ¡Ôñ" + { + case 1: + printf("\n\t\tÕýÔÚ½øÈë ÏÔʾËùÓгɼ¨ÐÅÏ¢½çÃæ\n\n\t\t"); + system("cls"); //ÏÈÇåÆÁ + stupaixu(); //ÔÙµ÷Óú¯Êý£¬ÏÔʾ½çÃæ + system("pause"); //½«ÏÔʾµÄ½çÃæ¹Ì¶¨×¡ + break; + case 2: + printf("\n\t\tÕýÔÚ½øÈë °´·ÖÊý¶ÎÏÔʾ³É¼¨ÐÅÏ¢½çÃæ\n\n\t\t"); + system("cls"); //ÏÈÇåÆÁ + fsdxs(); //ÔÙµ÷Óú¯Êý£¬ÏÔʾ½çÃæ + system("pause"); //½«ÏÔʾµÄ½çÃæ¹Ì¶¨×¡ + break; + case 3: + printf("\n\t\tÕýÔÚ½øÈë °´Ñ§ºÅ²éѯ³É¼¨ÐÅÏ¢½çÃæ\n\n\t\t"); + system("cls"); //ÏÈÇåÆÁ + xhcz(); //ÔÙµ÷Óú¯Êý£¬ÏÔʾ½çÃæ + system("pause"); //½«ÏÔʾµÄ½çÃæ¹Ì¶¨×¡ + case 4: + printf("\n\t\tÕýÔÚ½øÈë °´ÐÕÃû²éѯ³É¼¨ÐÅÏ¢½çÃæ\n\n\t\t"); + system("cls"); //ÏÈÇåÆÁ + namecz(); //ÔÙµ÷Óú¯Êý£¬ÏÔʾ½çÃæ + system("pause"); //½«ÏÔʾµÄ½çÃæ¹Ì¶¨×¡ + break; + case 0: + printf("\n\t\tÕýÔÚΪÄú·µ»ØÉÏÒ»½çÃæ\n\n\t\t"); + system("cls"); + return main(); //·µ»ØÖ÷½çÃæ + } + return stdk(); //·µ»ØѧÉú¶Ë¿Ú +} + +int tedk() //½Ìʦ¶Ë¿Ú "te == ÀÏʦ£¬ dk == ¶Ë¿Ú" +{ + char xuanze; //"Ñ¡Ôñ" + int xz; //"Ñ¡Ôñ"µÄÕûÐÍ·µ»ØÖµ + do + { + system("cls"); //ÇåÆÁ + printf("\n\t\t************ºþÄϹ¤Òµ´óѧÐÅÏ¢¹ÜÀíϵͳ************\n"); + printf("\t\t*©°-------------------------------------------©´ *\n"); + printf("\t\t*©¦ ÇëÑ¡ÔñÄúÐèÒªµÄ·þÎñ: ©¦ *\n"); + printf("\t\t*©¦ 1.ÏÔʾËùÓÐѧÉúµÄ³É¼¨ÐÅÏ¢ ©¦ *\n"); + printf("\t\t*©¦ 2.°´·ÖÊý¶ÎÏÔʾ³É¼¨ÐÅÏ¢ ©¦ *\n"); + printf("\t\t*©¦ 3.°´Ñ§ºÅ²éѯ³É¼¨ÐÅÏ¢ ©¦ *\n"); + printf("\t\t*©¦ 4.°´ÐÕÃû²éѯ³É¼¨ÐÅÏ¢ ©¦ *\n"); + printf("\t\t*©¦ 5.ÔöÌíѧÉúÐÅÏ¢ ©¦ *\n"); + printf("\t\t*©¦ 6.ÐÞ¸ÄѧÉúÐÅÏ¢ ©¦ *\n"); + printf("\t\t*©¦ 7.ɾ³ýѧÉúÐÅÏ¢ ©¦ *\n"); + printf("\t\t*©¦ 0.·µ»ØÉÏÒ»½çÃæ ©¦ *\n"); + printf("\t\t*©¸-------------------------------------------©¼ *\n"); + printf("\t\t************************************************\n"); + printf("\t\tÇëÄúÑ¡Ôñ(0-7):"); + fflush(stdin); //·ÀÖ¹Óû§Ò»´ÎÐÔÊäÈë¶à¸ö×Ö·û + scanf("%c", &xuanze); //²é¿´Óû§µÄÉí·Ý£¬½øÈëÏÂÒ»½çÃæ + }while(xuanze<'0' || xuanze>'7'); //¼ì²éÊäÈëÊÇ·ñ·ûºÏ¹æ·¶ + xz = xuanze-'0'; //½«×Ö·ûÐÍ"Ñ¡Ôñ"±ä³ÉËüµÄÕûÐÍ·µ»ØÖµ + switch(xz) //½«ÕûÐÍ·µ»ØÖµ½øÐÐ "Ñ¡Ôñ" + { + case 1: + printf("\n\t\tÕýÔÚ½øÈë ÏÔʾËùÓгɼ¨ÐÅÏ¢½çÃæ\n\n\t\t"); + system("cls"); //ÏÈÇåÆÁ + stupaixu(); //ÔÙµ÷Óú¯Êý£¬ÏÔʾ½çÃæ + system("pause"); //½«ÏÔʾµÄ½çÃæ¹Ì¶¨×¡ + break; + case 2: + printf("\n\t\tÕýÔÚ½øÈë °´·ÖÊý¶ÎÏÔʾ³É¼¨ÐÅÏ¢½çÃæ\n\n\t\t"); + system("cls"); //ÏÈÇåÆÁ + fsdxs(); //ÔÙµ÷Óú¯Êý£¬ÏÔʾ½çÃæ + system("pause"); //½«ÏÔʾµÄ½çÃæ¹Ì¶¨×¡ + break; + case 3: + printf("\n\t\tÕýÔÚ½øÈë °´Ñ§ºÅ²éѯ³É¼¨ÐÅÏ¢½çÃæ\n\n\t\t"); + system("cls"); //ÏÈÇåÆÁ + xhcz(); //ÔÙµ÷Óú¯Êý£¬ÏÔʾ½çÃæ + system("pause"); //½«ÏÔʾµÄ½çÃæ¹Ì¶¨×¡ + case 4: + printf("\n\t\tÕýÔÚ½øÈë °´ÐÕÃû²éѯ³É¼¨ÐÅÏ¢½çÃæ\n\n\t\t"); + system("cls"); //ÏÈÇåÆÁ + namecz(); //ÔÙµ÷Óú¯Êý£¬ÏÔʾ½çÃæ + system("pause"); //½«ÏÔʾµÄ½çÃæ¹Ì¶¨×¡ + break; + case 5: + printf("\n\t\tÕýÔÚ½øÈë ÔöÌíѧÉúÐÅÏ¢½çÃæ\n\n\t\t"); + system("cls"); //ÏÈÇåÆÁ + addstu(); //ÔÙµ÷Óú¯Êý£¬ÏÔʾ½çÃæ + system("pause"); //½«ÏÔʾµÄ½çÃæ¹Ì¶¨×¡ + break; + case 6: + printf("\n\t\tÕýÔÚ½øÈë °´Ñ§ºÅ²éѯ£¬ÐÞ¸ÄÐÅÏ¢½çÃæ\n\n\t\t"); + system("cls"); //ÏÈÇåÆÁ + xxxg(); //ÔÙµ÷Óú¯Êý£¬ÏÔʾ½çÃæ + system("pause"); //½«ÏÔʾµÄ½çÃæ¹Ì¶¨×¡ + break; + case 7: + printf("\n\t\tÕýÔÚ½øÈë °´Ñ§ºÅ²éѯ£¬É¾³ýÐÅÏ¢½çÃæ\n\n\t\t"); + system("cls"); //ÏÈÇåÆÁ + shanchu(); //ÔÙµ÷Óú¯Êý£¬ÏÔʾ½çÃæ + system("pause"); //½«ÏÔʾµÄ½çÃæ¹Ì¶¨×¡ + break; + case 0: + printf("\n\t\tÕýÔÚΪÄú·µ»ØÉÏÒ»½çÃæ\n\n\t\t"); + system("cls"); + return main(); //·µ»ØÖ÷º¯Êý + } + return tedk(); //·µ»Ø½Ìʦ¶Ë¿Ú +} + +int namecz() //"cz == ²éÕÒ"£¬ÓÃ"ÐÕÃû"½øÐвéÕҵĺ¯Êý +{ + FILE *fp=NULL; //¶¨ÒåÎļþÖ¸Õë + STU st[1000]; //Áãʱ´¢´æÊý¾ÝµÄ½á¹¹ÌåÊý×é + int i, k=0; //k ÓÃÓÚ¼ÆËãѧÉúÈËÊý + char names[20]; //¶¨ÒåÓû§ÊäÈëÐè²éÕÒµÄѧÉúÐÕÃû£¬·½±ã½øÐÐ±È¶Ô + if((fp = fopen("xsxx.txt","r"))==NULL) //´ÓÎļþ¶Á³öËùÓÐѧÉúÐÅÏ¢£¬´æÈëÁãʱ½á¹¹Ì壬½øÐÐ±È¶Ô + { + printf("\n\t\tError\n\n\t\t"); + exit(0); + } + while(!feof(fp)) + { + fscanf(fp,"%s %s %s %s %d %d %d %d",&st[k].name,&st[k].xuehao,&st[k].phone,&st[k].qq,&st[k].score[0], &st[k].score[1],&st[k].score[2],&st[k].sum); + k++; //ÿ¶ÁÈëÒ»¸öѧÉúµÄÐÅÏ¢£¬¼Ç¼ѧÉúµÄ×ÜÊý + } + fclose(fp); + printf("\n\t\tÇëÊäÈëѧÉúÐÕÃû:\n\n\t\t"); + scanf("%s", &names); + for(i=0; i<=k; i++) + { + if(strcmp(names,st[i].name)==0) + break; + } + if(i>k) //Èç¹ûÅжÏÍêËùÓÐÈ˵ÄÐÕÃû¶¼¶Ô²»ÉÏ£¬Ö´Ðд˲½Öè + { + system("cls"); + printf("\n\t\t²éÎÞ´ËÈË!\n\n\t\t"); + system("pause"); + return main(); + } + else //Èç¹û i < k ³ÉÁ¢£¬¾Í˵Ã÷ÓÐÆ¥ÅäµÄ£¬Ö´Ðд˲½Öè + { + system("cls"); //ÏÈÇåÆÁ£¬ÔÙÏÔʾÐÅÏ¢£¬¾Í²»ÂÒÁË + printf("\n\t\t********************************ѧÉúÐÅÏ¢******************************\n"); + printf("\t\t----------------------------------------------------------------------\n"); + printf("\t\tÐÕÃû:%-16s\tѧºÅ:%-16s\n",st[i].name,st[i].xuehao); + printf("\t\tÊÖ»úºÅ:%-16s\tQQºÅ:%-16s\n",st[i].phone,st[i].qq); + for(int s=0; s<3; s++) + { + printf("\t\t"); + printf("µÚ%d¿ÆÄ¿³É¼¨:%3d",s+1,st[i].score[s]); + } + printf("\n\t\t×Ü·Ö:%d\n",st[i].sum); + printf("\t\t----------------------------------------------------------------------\n"); + printf("\n\t\t"); + system("pause"); //ÏÈÈÃÓû§¿´¹»ÁË , È»ºó°´ÈÎÒâ¼ü·µ»Ø + return main(); //Êä³ö½áÊøºó¾Í·µ»ØÖ÷½çÃæ + } +} \ No newline at end of file