您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 人事档案/员工关系 > C语言学生选课管理系统
±¾³ÌÐòËùÓдúÂë¾ùÓÉÎÒÃÇ×éµÄѧ°ÔÊÖ¹¤´òÔ죬²»´æÔÚÓëÆäËû´úÂëÏàͬµÄÇé¿ö¡£´úÂëÊÇÓÉCÓïÑÔд³ÉµÄ£¬¶àÓÃÓÚºóÈýÕµÄÄÚÈÝ£¬Êý¾ÝµÄ±£´æÓõÄÊÇÎļþ¼ÈëµÄ·½Ê½£¨¾ÍÊÇ´´½¨Îı¾Îļþ±£´æÊý¾Ý£©ÓŵãÊÇ¿ª¹Ø»úºóÊý¾ÝÈÔÔÚ£¬£¨¼´Ê¹´ð±çµÄʱºò»»»úÆ÷£¬Ö»Òª°ÑÊÂÇ°´´½¨ºÃµÄÎļþ¿½±´¹ýÈ¥¾ÍÐÐÁË£¬Êý¾ÝÈÔÔÚ£©¿Î³ÌÊý¾ÝºÍѧÉúµÇ¼ÃÜÂëµÄÊý¾Ý´æ·ÅÔÚ²»Í¬µÄÎļþ¼ÐÄÚ£¬¾ßÌåÎļþ·¾¶ÈçÏ£º±¾³ÌÐòËùÓдúÂë¾ùÓÉÎÒÃÇ×éµÄѧ°ÔÊÖ¹¤´òÔ죬²»´æÔÚÓëÆäËû´úÂëÏàͬµÄÇé¿ö¡£´úÂëÊÇÓÉCÓïÑÔд³ÉµÄ£¬¶àÓÃÓÚºóÈýÕµÄÄÚÈÝ£¬Êý¾ÝµÄ±£´æÓõÄÊÇÎļþ¼ÈëµÄ·½Ê½£¨¾ÍÊÇ´´½¨Îı¾Îļþ±£´æÊý¾Ý£©ÓŵãÊÇ¿ª¹Ø»úºóÊý¾ÝÈÔÔÚ£¬£¨¼´Ê¹´ð±çµÄʱºò»»»úÆ÷£¬Ö»Òª°ÑÊÂÇ°´´½¨ºÃµÄÎļþ¿½±´¹ýÈ¥¾ÍÐÐÁË£¬Êý¾ÝÈÔÔÚ£©¿Î³ÌÊý¾ÝºÍѧÉúµÇ¼ÃÜÂëµÄÊý¾Ý´æ·ÅÔÚ²»Í¬µÄÎļþ¼ÐÄÚ£¬¾ßÌåÎļþ·¾¶ÈçÏ£º¿Î³ÌÐÅÏ¢£¨°üÀ¨¹ÜÀíÔ±ÊäÈëµÄ¿Î³ÌÐÅÏ¢ºÍä¯ÀÀ¡¢²éѯÓõÄÐÅÏ¢£©F:\\file\\file.txt(Ö®ËùÒÔÓÃ\\¶ø²»ÊÇ\£¬ÊÇÒòΪÔÚCÖÐ\´ú±íתÒå×Ö·û£¬ÒªÊä³öÒ»¸ö\¾Í±ØÐëÓÃ\\)ѧÉúµÇ¼ÃÜÂ루¹ÜÀíÔ±µÄÃÜÂë³ÌÐòÉ趨ºÃµÄ123£¬Ñ§ÉúÕʺÅ1001Ò²ÊdzÌÐòÉ趨ºÃµÄ£©F:\\file\\file1.txt£¨Õâ¸öÃÜÂëÐèÒªÔÚ´úÂëÔËÐÐÇ°ÉèÖú㬾ÍÏ൱ÓÚ³õʼÃÜÂ룬·ñÔòµÇ¼²»½øÀ´£©Ñ§ÉúÑ¡¿ÎÐÅÏ¢£¨Ñ§ÉúÑ¡¿ÎµÄÇé¿ö²éѯģ¿é£©F:\\file\\file4.txt£¨ËùÓпγÌÐÅÏ¢¶¼ÊÇÔÚ³ÌÐòÔËÐÐʱ¼ÈëµÄ£¬²»ÐèÌáÇ°ÉèÖã©ÎļþµÄ·¾¶¿ÉÒÔÔÚ´úÂëÖнøÐиü¸Ä£¬µ«Í¬Ê±¼ÇµÃÌáÇ°ÔÚÉèÖõÄ·¾¶´´½¨ºÃÎļþ¡£#includestdio.h#includestdlib.h#includestring.h#includeconio.h#definesize2structcourse{charcode[10];charname[10];chartype[10];chartotal[10];charcla[10];charexperi[10];charcredict[10];charterm[10];}cour[size];structstudent{charnumber[10];charcourse[10];charcode[10];}student[2]={1001};voidsave()//´æÈëÎļþ{FILE*fp;//¶¨ÒåÖ¸ÏòÒ»¸öÎļþµÄÖ¸Õëinti;if((fp=fopen(F:\\file\\file.txt,wb))==NULL){printf(ÎÞ·¨´ò¿ª´ËÎļþ\n);exit(0);}for(i=0;isize;i++)if(fwrite(&cour[i],sizeof(structcourse),1,fp)!=1)printf(error\n);fclose(fp);}voidinput_infor()//ÊäÈëÐÅÏ¢{voidsave();voidmain_menu();inti;system(cls);printf(information:\n¿Î³Ì±àºÅ¿Î³ÌÃû³Æ¿Î³ÌÀàÐÍ×ÜѧʱÊÚ¿ÎѧʱÉÏ»úѧʱѧ·Ö¿ª¿ÎѧÆÚ\n);for(i=0;isize;i++){scanf(%s%s%s%s%s%s%s%s,cour[i].code,cour[i].name,cour[i].type,cour[i].total,cour[i].cla,cour[i].experi,cour[i].credict,cour[i].term);}save();system(cls);printf(\n\n\n\n¼ÈëÐÅÏ¢³É¹¦£¡\n);printf(***********************);printf(\n\n\n\n\n°´ÈÎÒâ¼üÌøתµ½Ö÷²Ëµ¥£º);getch();system(cls);}voidlook_infor()//ä¯ÀÀÐÅÏ¢{FILE*fp;inti;system(cls);if((fp=fopen(F:\\file\\file.txt,rb))==NULL){printf(error\n);exit(0);}printf(¿Î³Ì±àºÅ¿Î³ÌÃû³Æ¿Î³ÌÀàÐÍ×ÜѧʱÊÚ¿ÎѧʱÉÏ»úѧʱѧ·Ö¿ª¿ÎѧÆÚ\n);for(i=0;isize;i++){fread(&cour[i],sizeof(structcourse),1,fp);printf(%-4s%10s%10s%8s%8s%8s%8s%8s\n,cour[i].code,cour[i].name,cour[i].type,cour[i].total,cour[i].cla,cour[i].experi,cour[i].credict,cour[i].term);}fclose(fp);printf(\n\n\n\n\n°´ÈÎÒâ¼üÌøתµ½Ö÷²Ëµ¥£º);getch();//ÔÝÍ£³ÌÐò£¬°´ÈÎÒâ¼ü¼ÌÐøsystem(cls);}voidmenu_1(){printf(\n\n);printf(\t»¶Ó½øÈëѧÉúÑ¡¿Îϵͳ\t\t\n);printf(\t*********************************************************\t\t\n\n\n\n\n\n);printf(\t1-¹ÜÀíÕß½øÈë\t\t\n\n);printf(\t2-ѧÉú½øÈë\n\n\n);printf(\t3-Í˳öϵͳ\n\n\n\n);}voidmenu_2(){printf(\n\n\n¹ÜÀíÕß½çÃæ\n);printf(****************\n\n\n\n\n\n);printf(\t\t1-ÐÅÏ¢ÊäÈë\n\n);printf(\t\t2-ÐÅÏ¢ä¯ÀÀ\n\n\n);printf(\t\t3-ÐÅÏ¢²éѯ\n\n);printf(\t\t4-Í˳öϵͳ\n\n\n);}voidmenu_3(){printf(\n\n\nѧÉú½çÃæ\n);printf(******************\n\n\n\n\n);printf(\t\t1-ÐÅÏ¢ä¯ÀÀ2-ÐÅÏ¢²éѯ\n\n\n);printf(\t\t3-ѧÉúÑ¡¿Î4-ѧÉúÑ¡¿ÎÇé¿öä¯ÀÀ\n\n\n);printf(\t\t5-ÐÞ¸ÄÃÜÂë6-Í˳öϵͳ\n\n\n);}voidchange_code(){FILE*fp;charcode[10],newcode[10];inta;intx=0,inti=3,inty=0;loop4:printf(*ÇëÊäÈëÔÀ´µÄÃÜÂ룺);x=0;while((code[x]=getch())!='\r'){if(code[x]=='\b'){printf(\b\b);x--;}else{putchar('*');x++;}}code[x]='\0';printf(\n*ÇëÊäÈëÄãµÄÐÂÃÜÂ룺);y=0;while((newcode[y]=getch())!='\r'){if(newcode[y]=='\b'){printf(\b\b);y--;}else{putchar('*');y++;}}newcode[y]='\0';if(strcmp(code,student[0].code)==0){strcpy(student[0].code,newcode);if((fp=fopen(F:\\file\\file1.txt,wb))==NULL)//½«Ð޸ĺóµÄÃÜÂë´æÈëÎļþ{printf(ÎÞ·¨´ò¿ª´ËÎļþ\n);exit(0);}fwrite(&student[0].code,sizeof(structstudent),1,fp);fclose(fp);system(cls);printf(\n\n\nÃÜÂëÐ޸ijɹ¦£¡\n);printf(****************\n\n\n\n\n\n);printf(°´ÈÎÒâ¼ü·µ»ØÖ÷²Ëµ¥\n);getch();system(cls);}else{system(cls);printf(ÔÃÜÂëÊäÈë²»ÕýÈ·£¡\n);printf(*********************);printf(\n\n\n\n\n¼ÌÐøÐÞ¸ÄÇëÊäÈë1\n);printf(Í˳ö·µ»ØÖ÷²Ëµ¥ÇëÊäÈë2\n\n\n\n);printf(ÇëÊäÈëÄãµÄ²Ù×÷£º);scanf(%d,&a);switch(a){case1:system(cls);gotoloop4;case2:system(cls);}}}voidsearch()//¿Î³ÌÐÅÏ¢²éѯ{voidput_infor();inta;inti;charmin[10],kind[10],grade[10],no[10],date[10];system(cls);L1:printf(\n\n\t\t**********ÇëÑ¡Ôñ²éѯ·½Ê½*************\n);printf(\n\t\t\t1---°´¿Î³Ì±àºÅ²éÕÒ\n);printf(\n\t\t\t2---°´¿Î³ÌÃû³Æ²éÕÒ\n);printf(\n\t\t\t3---°´¿Î³ÌÐÔÖʲéÕÒ\n);printf(\n\t\t\t4---°´¿Î³Ìѧ·Ö²éÕÒ\n);printf(\n\t\t\t5---°´¿ª¿ÎѧÆÚ²éÕÒ\n);printf(\n\t\t\t6---Í˳ö²éÕÒ\n);printf(\n\n\t\t**************************************\n);printf(\n\nChooseyournumber(1-6):[]\b\b);scanf(%d,&a);switch(a){case1:system(cls);printf(ÊäÈëÒª²éÕҵĿγ̵ıàºÅ:);scanf(%s,no);put_infor();printf(¿Î³Ì±àºÅ¿Î³ÌÃû³Æ¿Î³ÌÐÔÖÊ×ÜѧʱÊÚ¿Îѧʱʵ¼ù»òÉÏ»úѧʱѧ·Ö¿ª¿ÎѧÆÚ\n);for(i=0;isize;i++){if(cour[i].code!=NULL&&strcmp(no,cour[i].code)==0){printf(%-4s%10s%10s%8s%8s%8s%8s%8s\n,cour[i].code
本文标题:C语言学生选课管理系统
链接地址:https://www.777doc.com/doc-5152695 .html