| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1890 人关注过本帖
标题:[转帖][求助]请高手帮我修改一下这个程序,谢谢了!
只看楼主 加入收藏
心系风铃
Rank: 1
等 级:新手上路
帖 子:145
专家分:0
注 册:2004-12-23
收藏
得分:0 
以下是引用Kyo在2004-12-30 00:16:11的发言: 天啊!你还真是50年不变啊?这么凶小心没有敢“娶你”。叫你别老是帮同学发一些作业贴上来的叫人做的哦!不过你那个同学还真是高手,那个程序我看一了一下就晕了,你同学真的是计算机专业的吗?难怪knocker会说写这个程序的人肯定没有过二级C,以后别老是做好人了。最近管理员好像也在发贴考虑要不要删了这些老是发作业上来人,所以你别再帮人发这些贴上来了。 如果你想帮别人的话就自己做,自己懒不想去复习以前的C老是想在这里叫人帮忙,真想不出以前还是“C高手”呢!!!呵呵。。。。。去看看以前的书吧,小懒虫。。。。。。
知道了知道了!你对行了吧!我会好好看书的,对了Kyo,本来我这个贴子是悬赏200的,为什么只剩下悬赏20的?我现在才注意到,能不能帮我加个悬赏积分上去啊?反正我要那些积分也没什么用的?有空帮我补发悬赏贴,最少也要上百积分的,不发你就是小气鬼。。。

年初二 拿利事
2004-12-30 01:29
断线风筝
Rank: 1
等 级:新手上路
帖 子:61
专家分:0
注 册:2004-5-20
收藏
得分:0 
哇噻,不可思议呢,跑题了吧
2004-12-30 09:13
workhard
Rank: 1
等 级:新手上路
帖 子:96
专家分:0
注 册:2004-11-17
收藏
得分:0 

我没有加文件保存,程序可以运行。

<!--StartFragment--># include<stdio.h> # include<conio.h> # include<string.h> struct student { char num[15]; char name[20]; char curcus[10][5]; char curcusname[10][10]; }; int m; int curricula; void clrscr(){ for(int i=0;i<38;i++) printf("\n"); } void mainmenu()//显示主界面 { clrscr(); printf("\n\n\n\n\n\n\n\n"); printf(" $*************************************$\n"); printf(" $ 0-------7 $\n"); printf(" $*************************************$\n"); printf(" $ 1-创建 $\n"); printf(" $ 2-显示 $\n"); printf(" $ 3-查询 $\n"); printf(" $ 4-修改 $\n"); printf(" $ 5-删除 $\n"); printf(" $ 6-插入 $\n"); printf(" $ 7-排序 $\n"); printf(" $ 0-退出 $\n"); printf(" $*************************************$\n"); printf(" "); } void creat(student stu[10])//创建 { int i,j; clrscr(); for(j=0;j<curricula;j++){ printf("请输入课程名称:\n"); gets(stu[0].curcusname[j]); } for(i=0;i<m;i++) { printf("\n"); printf("Please importation the %d record:\n",i); printf("num:"); do { gets(stu[i].num); } while(strcmp(stu[i].num,"") ==0);//保证输入的学好不为零 printf("name:"); gets(stu[i].name); for( j=0;j<curricula;j++) { printf("请输入第%d 门课程的成绩:",j); gets(stu[i].curcus[j]); } } } void display(student stu[10])//显示 { int i,j; clrscr(); // printf(str); printf(" num name"); for(j=0;j<curricula;j++) {printf("%8s",stu[0].curcusname[j]); } printf("\n"); for(i=0;i<m;i++) {printf("%13s%16s",stu[i].num,stu[i].name); for( j=0;j<curricula;j++) printf("%8s",stu[i].curcus[j]); printf("\n"); } } void qui_num(student stu[10])//按学号查找 { int i,j,flag=0; char nm[15]; printf("\n Please the importatiom regisration number:"); gets(nm); for(i=0;i<m;i++) if(strcmp(nm,stu[i].num)==0) { printf(" num name"); for(j=0;j<curricula;j++) {printf("%8s",stu[0].curcusname[j]); } printf("\n"); printf("%13s%16s",stu[i].num,stu[i].name); for( j=0;j<curricula;j++) printf("%8s",stu[i].curcus[j]); flag=1; } if(flag==0) printf("\n Check to have no this record! \n"); } void qui_name(student stu[10])//按姓名查找 { int i,j,flag=0; char nam[20]; printf("\n Please the importatiom name:");gets(nam); for(i=0;i<m;i++) if(strcmp(nam,stu[i].name)==0) { printf(" num name"); for(j=0;j<curricula;j++) {printf("%8s",stu[0].curcusname[j]); } printf("\n"); printf("%13s%16s",stu[i].num,stu[i].name); for( j=0;j<curricula;j++) printf("%8s",stu[i].curcus[j]); flag=1; } if(flag==0) printf("Check to have no this record! \n"); } void scarch(student stu[10])//查找 { char c; display(stu); printf("Press registration number search(n),press name search(x)?"); c=getche(); if(c=='n'||c=='N') qui_num(stu); else if(c=='x'||c=='X') qui_name(stu); else printf("\n Input the mistake word sign! \n"); } void modify(student stu[10])//修改 { int i,j; char nam[20]; clrscr(); display(stu); printf("Ask importation to want to modify the name of the record: \n"); gets(nam); for(i=0;i<m;i++) if (strcmp(nam,stu[i].name)==0) break; if(i==m) printf("Check to have no this record! \n"); else { printf("Please input the right registration number: \n"); do {gets(stu[i].num);} while(strcmp(stu[i].num,"")==0); printf("Newname:");gets(stu[i].name); for( j=0;j<curricula;j++) { printf("请输入第%d 门课程的成绩:",j); gets(stu[i].curcus[j]); } display(stu); } } void deletee(student stu[10])//删除 { int i,j,x; char c,nm[15],nam[20],cur[15]; clrscr(); display(stu); printf("Press the registration number deletion(h),still press name deletion(l),press curcuse deletion(c)?"); c=getche(); if (c=='h'||c=='H')//按学号删除 { printf("\n Ask importation to want to delete the registration number of the record: \n"); gets(nm); for (x=0;x<m;x++) if (strcmp(nm,stu[x].num)==0) break; if (x<m) { for (i=x;i<m-1;i++) { strcpy(stu[i].num,stu[i+1].num); strcpy(stu[i].name,stu[i+1].name); for(int j=0;j<curricula;j++) strcpy(stu[i].curcus[j],stu[i+1].curcus[j]); } m--; display(stu); } else printf("Check to have no this record! \n"); } else if (c=='l'||c=='L')//按姓名删除 { printf("\n Ask importation to want to delete the name the record: \n"); gets(nam); for (x=0;x<m;x++) if (strcmp(nam,stu[x].name)==0) break; if (x<m) { for (i=x;i<m-1;i++) { strcpy(stu[i].num,stu[i+1].num); strcpy(stu[i].name,stu[i+1].name); for(int j=0;j<curricula;j++) strcpy(stu[i].curcus[j],stu[i+1].curcus[j]); } m--; display(stu); } else printf("Check to have no this record! \n"); } else if (c=='c'||c=='C')//删除一门课程 { printf("\n Ask importation to want to delete the curcuse the record: \n"); gets(cur); for(x=0;x<curricula;x++) if(strcmp(cur,stu[0].curcusname[x])==0) break; if (x<curricula) { for(i=x;i<curricula;i++) { strcpy(stu[0].curcusname[i],stu[0].curcusname[i]); for (j=0;j<m;j++) strcpy(stu[j].curcus[i],stu[j].curcus[i+1]); } curricula--; display(stu); } else printf("Check to have no this record! \n"); } else printf("\n Input the mistake word sign! \n"); } void Increasestudent(student stu[10])//增加学生 { char c,tempnum[15],tempname[20]; clrscr(); display(stu); clrscr(); do { printf(" please the registration number of input the new record: \n"); do {gets(tempnum);} while(strcmp(tempnum,"")==0); printf(" please the surname number of input the new record: \n"); gets(tempname); for (int i=0;i<m;i++) if (strcmp(tempnum,stu[i].num)==0 || strcmp(tempname,stu[i].name)==0) { printf("Registration number or the name repetition want to inprt(YES\\NO)?"); c=getche(); putchar('\n'); break; } if(i==m) { strcpy(stu[i].num,tempnum); strcpy(stu[i].name,tempname); for(int j=0;j<curricula;j++){ printf("请输入第%d 门课程的成绩:",j); gets(stu[i].curcus[j]); } printf(" New result record:\n"); m++; display(stu); break; } }while(c=='y' || c=='Y'); } void Increasecurricual(student stu[10]){//增加课程 int i,j; char c; char course[10]; clrscr(); display(stu); clrscr(); do { printf("请输入课程名称:\n"); do {gets(course);} while(strcmp(course,"")==0); for (j=0;j<curricula;j++) if (strcmp(course,stu[0].curcusname[j])==0 ) { printf("Registration curcusename repetition want to inprt(YES\\NO)?"); c=getche(); putchar('\n'); break; } if(j==curricula) { strcpy(stu[0].curcusname[j],course); for( i=0;i<m;i++){ printf("请输入第%d 个学生的该门课程的成绩:",i); gets(stu[i].curcus[j]); } curricula++; printf(" New result record:\n"); display(stu); break; } }while(c=='y' || c=='Y'); } void Increase(student stu[10])//增加 { clrscr(); char c; printf("Press registration student increase(s),press curcuse search(c)?"); c=getche(); if(c=='s'||c=='S') Increasestudent(stu); else if(c=='c'||c=='C') Increasecurricual(stu); else printf("\n Input the mistake word sign! \n"); } void Arrange(student stu[10])//排序 { int i,j,l; char g,h,temp[10]; clrscr(); printf(" The result record that did not arrange: \n"); display(stu); printf("Press the registration numbdr alignment(n),still press name alignment(b)?"); g=getche(); if(g=='n' || g=='N') { printf("\n Press agreeable row(s),still negative row(f)?"); h=getche(); if(h=='s' || h=='S') { for(i=0;i<m-1;i++) { l=i; for(j=i;j<m;j++) if(strcmp(stu[l].num,stu[j].num) >0) l=j; strcpy(temp,stu[l].num); strcpy(stu[l].num,stu[i].num); strcpy(stu[i].num,temp); strcpy(temp,stu[l].name); strcpy(stu[l].name,stu[i].name); strcpy(stu[i].name,temp); for(int k=0;k<curricula;k++) { strcpy(temp,stu[l].curcus[k]); strcpy(stu[l].curcus[k],stu[i].curcus[k]); strcpy(stu[i].curcus[k],temp); } } printf("\n Arrange the result record of empress: \n"); display(stu); } else if(h=='f' || h=='F') { for(i=0;i<m-1;i++) { l=i; for(j=i;j<m;j++) if(strcmp(stu[l].num,stu[j].num) <0) l=j; strcpy(temp,stu[l].num); strcpy(stu[l].num,stu[i].num); strcpy(stu[i].num,temp); strcpy(temp,stu[l].name); strcpy(stu[l].name,stu[i].name); strcpy(stu[i].name,temp); for(int k=0;k<curricula;k++) { strcpy(temp,stu[l].curcus[k]); strcpy(stu[l].curcus[k],stu[i].curcus[k]); strcpy(stu[i].curcus[k],temp); } } printf("\n Arrange the result record of empress: \n"); display(stu); } else printf("\n Illegal character list! \n"); } else if (g=='b' || g=='B') { printf("\n Press agreeable row(s),still negative row(f)?"); h=getche(); if(h=='s' || h=='S') { for(i=0;i<m-1;i++) { l=i; for(j=i;j<m;j++) if(strcmp(stu[l].name,stu[j].name) >0) l=j; strcpy(temp,stu[l].num); strcpy(stu[l].num,stu[i].num); strcpy(stu[i].num,temp); strcpy(temp,stu[l].name); strcpy(stu[l].name,stu[i].name); strcpy(stu[i].name,temp); for(int k=0;k<curricula;k++) { strcpy(temp,stu[l].curcus[k]); strcpy(stu[l].curcus[k],stu[i].curcus[k]); strcpy(stu[i].curcus[k],temp); } } printf("\n Arrange the result record of empress: \n"); display(stu); } else if(h=='f' || h=='F') { for(i=0;i<m-1;i++) { l=i; for(j=i;j<m;j++) if(strcmp(stu[l].name,stu[j].name) <0) l=j; strcpy(temp,stu[l].num); strcpy(stu[l].num,stu[i].num); strcpy(stu[i].num,temp); strcpy(temp,stu[l].name); strcpy(stu[l].name,stu[i].name); strcpy(stu[i].name,temp); for(int k=0;k<curricula;k++) { strcpy(temp,stu[l].curcus[k]); strcpy(stu[l].curcus[k],stu[i].curcus[k]); strcpy(stu[i].curcus[k],temp); } } printf("\n Arrange the result record of empress: \n"); display(stu); } else printf("\n Illegal character list! \n"); } else printf("\n Illegal character list! \n"); } void main(){ student stu[10]; m=3; curricula=3; char choice,yes_no; do { clrscr(); mainmenu(); printf(" "); choice=getche(); switch(choice) { case'1':creat(stu);break; case'2':display(stu);break; case'3':scarch(stu);break; case'4':modify(stu);break; case'5':deletee(stu);break; case'6':Increase(stu);break; case'7':Arrange(stu);break; case'0':break; default:printf(" choice=%c!Illegal operation\n",choice); } if(choice=='0')break;//终止程序 printf("\n Need to be chosen afresh(Yes\\No)?\n"); do {yes_no=getch();} while (yes_no!='Y'&&yes_no!='y'&&yes_no!='N'&&yes_no!='n'); } while(yes_no=='Y'||yes_no=='y'); }


2004-12-30 09:22
lmr
Rank: 1
等 级:新手上路
帖 子:86
专家分:0
注 册:2004-12-9
收藏
得分:0 
有意思,真是大开眼界,原来这里面还如此的精彩啊!加把劲!
2004-12-30 11:25
fish88q
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2004-12-22
收藏
得分:0 
workhard我刚才看了你改的程序了,真的谢谢啦。要不是太远,应该吃你吃饭,喝茶。这里真的很不错的,我会介绍我朋友过来的。
2004-12-30 13:15
心系风铃
Rank: 1
等 级:新手上路
帖 子:145
专家分:0
注 册:2004-12-23
收藏
得分:0 
以下是引用fish88q在2004-12-30 13:15:01的发言: workhard我刚才看了你改的程序了,真的谢谢啦。要不是太远,应该吃你吃饭,喝茶。这里真的很不错的,我会介绍我朋友过来的。
  好像你要请我才对吧!

年初二 拿利事
2005-01-06 16:06
快速回复:[转帖][求助]请高手帮我修改一下这个程序,谢谢了!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017900 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved