| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1890 人关注过本帖
标题:[转帖][求助]请高手帮我修改一下这个程序,谢谢了!
只看楼主 加入收藏
心系风铃
Rank: 1
等 级:新手上路
帖 子:145
专家分:0
注 册:2004-12-23
收藏
 问题点数:0 回复次数:25 
[转帖][求助]请高手帮我修改一下这个程序,谢谢了!

一.题目:这是一个学生程序管理系统

二,要求:

1.能建立新数据文件,存放学生信息及成绩.

2.能追加新记录.

3.能修改已有记录.

4.能删除错误记录.

5.能查询部分记录.

6.能排序部分记录.

7.能用菜单方法操作.

以下是友人所做,我看不懂,请高手帮忙修一下.

# define m 5 # include<stdio.h> # include<conio.h> # include<string.h> void main menu() { clrscr(); printf("\n\n\n\n\n\n\n\n"); printf(" $*************************************$\n"); printf(" $ 0-------7 $\n"); printf(" $*************************************$\n"); printf(" $ 1-Establish the resrlt watch $\n"); printf(" $ 2-Show the resrlt watch $\n"); printf(" $ 3-Scarch the resrlt record $\n"); printf(" $ 4-Modify the result record $\n"); printf(" $ 5-Delete the result record $\n"); printf(" $ 6-Increase the new result record $\n"); printf(" $ 7-Arrange the result record $\n"); printf(" $ 0-Exit $\n"); printf(" $*************************************$\n"); } void creat(char num[m][20],char name[m][20],char mht[m][20],char els[m][20],char law[m][20]) { int i; clrscr(); for(i=0;i<m;i++) { printf("\n"); printf("Please importation the %d record:\n",i++); printf("num:"); do { gets(num[i]); } while(strcmp(num[i],"") ==0); printf("name:"); gets(name[i]); printf("mht:"); gets(mht[i]); printf("els:"); gets(els[i]); printf("law:"); gets(law[i]); } } void display(char num[m][20],char name[m][20],char mht[m][20],char els[m][20],char law[m][20]) { int i; clrscr(); printf(" num | name | mht | els | law |\n"); for(i=0;i<m;i++) printf("%13s%16s%7s%7s%7s\n",num[i],name[i],mht[i],els[i],law[i]); } void qui_num(char num[m][15],char name[m][20],char mht[m][5],char els[m][5],char law[m][5]) { int i,flag=0; char nm[15]; printf("\n Please the importatiom regisration number:");gets(nm); for(i=0;i<m;i++) if(strcmp(nm,num[i])==0) { printf(" num | name | mht | els | law |\n"); printf("%13s%16s%7s%7s%7s\n",num[i],name[i],mht[i],els[i],law[i]); flag=1; } if(flag==0) printf("\n Check to have no this record! \n"); } void qui_name(char num[m][15],char name[m][20],char mht[m][5],char els[m][5],char law[m][5]) { int i,flag=0; char nam[20]; printf("\n Please the importatiom name:");gets(nam); for(i=0;i<m;i++) if(strcmp(nam,num[i])==0) { printf(" num | name | mht | els | law |\n"); printf("%13s%16s%7s%7s%7s\n",num[i],name[i],mht[i],els[i],law[i]); flag=1; } if(flag==0) printf("Check to have no this record! \n"); } void scarch(char num[m][15],char name[m][20],char mht[m][5],char els[m][5],char law[m][5]) { char c; display(num,name,mht,els,law); printf("Press registration number search(n),press name search(x)?"); c=getche(); if(c=='n'||c=='N') qui_num(num,name,mht,els,law); else if(c=='x'||c=='X') qui_name(num,name,mht,els,law); else printf("\n Input the mistake word sign! \n"); } void modify(char num[m][15],char name[m][20],char mht[m][5],char els[m][5],char law[m][5]) { int i; char nam[20]; clrscr(); printf(" num | name | mht | els | law |\n"); for(i=0;i<m;i++) printf("%13s%16s%7s%7s%7s\n",num[i],name[i],mht[i],els[i],law[i]);

printf("Ask importation to want to modify the name of the record: \n"); gets(nam); for(i=0;i<m;i++) if (strcmp(nam,name[i])==0) break; if(i==m) printf("Check to have no this record! \n"); else { printf("Please input the right registration number: \n"); do {gets(num[i]);} while(strcmp(num[i],"")==0); printf("Newname:");gets(name[i]); printf("Newmht:"); gets(mht[i]); printf("Newels:");gets(els[i]); printf("Newlaw:");gets(law[i]); printf(" num | name | mht | els | law |\n"); for(i=0;i<m;i++) printf("%13s%16s%7s%7s%7s\n",num[i],name[i],mht[i],els[i],law[i]); } } void delete(char num[m][15],char name[m][20],char mht[m][5],char els[m][5],char law[m][5]) { int i,x; char c,nm[15],nam[20];

clrscr();

printf(" num | name | mht | els | law |\n"); for(i=0;i<m;i++) printf("%13s%16s%7s%7s%7s\n",num[i],name[i],mht[i],els[i],law[i]); printf("Press the registration number deletion(h),still press name deletion(l)?"); 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,num[x])==0) break; if (x<m) { for (i=x;i<m-1;i++) { strcpy(num[i],num[i+1]); strcpy(name[i],name[i+1]); strcpy(mht[i],mht[i+1]); strcpy(els[i],els[i+1]); strcpy(law[i],law[i+1]); } printf(" num | name | mht | els | law |\n"); for(i=0;i<m;i++) printf("%13s%16s%7s%7s%7s\n",num[i],name[i],mht[i],els[i],law[i]); } 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(nm,num[x])==0) break; if (x<m) { for (i=x;i<m-1;i++) { strcpy(num[i],num[i+1]); strcpy(name[i],name[i+1]); strcpy(mht[i],mht[i+1]); strcpy(els[i],els[i+1]); strcpy(law[i],law[i+1]); } printf(" num | name | mht | els | law |\n"); for(i=0;i<m;i++) printf("%13s%16s%7s%7s%7s\n",num[i],name[i],mht[i],els[i],law[i]); } else printf("Check to have no this record! \n"); } else printf("\n Input the mistake word sign! \n"); } void Increase(char num[10][15],char name[10][20],char mht[10][5],char els[10][5],char law[10][5]) { int i=0,k; char c,tempnum[15],tempname[20],tempmht[5],tempels[5],templaw[5];

clrscr();

printf(" num | name | mht | els | law |\n"); while(strcmp(num[i],"")!=0) { printf("%13s%16s%7s%7s%7s\n",num[i],name[i],mht[i],els[i],law[i]); i++; } k=i; 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); printf(" please the mht number of input the new record: \n");gets(tempmht); printf(" please the els number of input the new record: \n");gets(tempels); printf(" please the law number of input the new record: \n");gets(templaw); for (i=0;i<k;i++) if (strcmp(tempnum,num[i])==0 || strcmp(tempname,name[i])==0) { printf("Registration number or the name repetition want to inprt(YES\\NO)?"); c=getche(); putchar('\n'); break; } if(i==k) { strcpy(num[i],tempnum); strcpy(name[i],tempname); strcpy(mht[i],tempmht); strcpy(els[i],tempels); strcpy(law[i],templaw); printf(" New result record:\n"); printf(" num | name | mht | els | law |\n"); for(i=0;i<k+1;i++) printf("%13s%16s%7s%7s%7s\n",num[i],name[i],mht[i],els[i],law[i]); break; } }while(c=='y' || c=='Y'); } void Arrange(char num[m][15],char name[m][20],char mht[m][5],char els[m][5],char law[m][5]) { int i,j,l; char g,h,temp[10]; clrscr(); printf(" The result record that did not arrange: \n"); printf(" num | name | mht | els | law |\n"); for(i=0;i<m;i++) printf("%13s%16s%7s%7s%7s\n",num[i],name[i],mht[i],els[i],law[i]); 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(num[l],num[j]) >0) l=j; strcpy(temp,num[l]); strcpy(num[l],num[i]); strcpy(num[i],temp); strcpy(temp,name[l]); strcpy(name[l],name[i]); strcpy(name[i],temp); strcpy(temp,mht[l]); strcpy(mht[l],mht[i]); strcpy(mht[i],temp); strcpy(temp,els[l]); strcpy(els[l],els[i]); strcpy(els[i],temp); strcpy(temp,law[l]); strcpy(law[l],law[i]); strcpy(law[i],temp); } printf("\n Arrange the result record of empress: \n"); printf(" num | name | mht | els | law |\n"); for(i=0;i<m;i++) printf("%13s%16s%7s%7s%7s\n",num[i],name[i],mht[i],els[i],law[i]); } else if(h=='f' || h=='F') { for (i=0;i<m-1;i++) { l=i; for(j=i;j<m;j++) if(strcmp(num[l],num[j]) <0) l=j; strcpy(temp,num[l]); strcpy(num[l],num[i]); strcpy(num[i],temp); strcpy(temp,name[l]); strcpy(name[l],name[i]); strcpy(name[i],temp); strcpy(temp,mht[l]); strcpy(mht[l],mht[i]); strcpy(mht[i],temp); strcpy(temp,els[l]); strcpy(els[l],els[i]); strcpy(els[i],temp); strcpy(temp,law[l]); strcpy(law[l],law[i]); strcpy(law[i],temp); } printf("\n Arrange the result record of empress: \n"); printf(" num | name | mht | els | law |\n"); for(i=0;i<m;i++) printf("%13s%16s%7s%7s%7s\n",num[i],name[i],mht[i],els[i],law[i]); } 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(num[l],num[j]) >0) l=j; strcpy(temp,num[l]); strcpy(num[l],num[i]); strcpy(num[i],temp); strcpy(temp,name[l]); strcpy(name[l],name[i]); strcpy(name[i],temp); strcpy(temp,mht[l]); strcpy(mht[l],mht[i]); strcpy(mht[i],temp); strcpy(temp,els[l]); strcpy(els[l],els[i]); strcpy(els[i],temp); strcpy(temp,law[l]); strcpy(law[l],law[i]); strcpy(law[i],temp); } printf("\n Arrange the result record of empress: \n"); printf(" num | name | mht | els | law |\n"); for(i=0;i<m;i++) printf("%13s%16s%7s%7s%7s\n",num[i],name[i],mht[i],els[i],law[i]); } else if(h=='f' || h=='F') { for (i=0;i<m-1;i++) { l=i; for(j=i;j<m;j++) if(strcmp(num[l],num[j]) <0) l=j; strcpy(temp,num[l]); strcpy(num[l],num[i]); strcpy(num[i],temp); strcpy(temp,name[l]); strcpy(name[l],name[i]); strcpy(name[i],temp); strcpy(temp,mht[l]); strcpy(mht[l],mht[i]); strcpy(mht[i],temp); strcpy(temp,els[l]); strcpy(els[l],els[i]); strcpy(els[i],temp); strcpy(temp,law[l]); strcpy(law[l],law[i]); strcpy(law[i],temp); } printf("\n Arrange the result record of empress: \n"); printf(" num | name | mht | els | law |\n"); for(i=0;i<m;i++) printf("%13s%16s%7s%7s%7s\n",num[i],name[i],mht[i],els[i],law[i]); } else printf("\n Illegal character list! \n"); } else printf("\n Illegal character list! \n"); } main() { char choice,yes_no,num[m][15],name[m][20],mht[m][5],els[m][5],law[m][5]; do { clrscr(); mainmenu(); printf(" "); choice=getche(); switch(choice) { case'1':creat(num,name,mht,els,law);break; case'2':display(num,name,mht,els,law);break; case'3':scarch(num,name,mht,els,law);break; case'4':modify(num,name,mht,els,law);break; case'5':delete(num,name,mht,els,law);break; case'6':Increase(num,name,mht,els,law);break; case'7':Arrange(num,name,mht,els,law);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-26 20:03
Kyo
Rank: 6Rank: 6
等 级:贵宾
威 望:23
帖 子:4536
专家分:1
注 册:2004-12-27
收藏
得分:0 

哎,没人理你啊!好心你就认真复习一下,自己做嘛!你以前不是C高手吗?现在忘光了,求人不如求已啊!自己好好想想吧。不过别叫我帮你,我没空的。。。


2004-12-28 20:49
live41
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:67
帖 子:12442
专家分:0
注 册:2004-7-22
收藏
得分:0 
楼上的是楼主的BF吧?
2004-12-28 21:57
live41
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:67
帖 子:12442
专家分:0
注 册:2004-7-22
收藏
得分:0 
我想问楼主,你想怎么个修法?你好歹也说出哪里不行啊!
2004-12-28 21:59
心系风铃
Rank: 1
等 级:新手上路
帖 子:145
专家分:0
注 册:2004-12-23
收藏
得分:0 

很惭愧啊。这道程序是同学叫我看的,不过我看不懂,而且还不懂那里不懂,所以我也说不出哪里不行啊,没法子,四年前的东西我早忘光光。。。


年初二 拿利事
2004-12-28 23:26
fish88q
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2004-12-22
收藏
得分:0 

就是增加一些课程如:英语,数学,物理等的查询。

2004-12-28 23:36
断线风筝
Rank: 1
等 级:新手上路
帖 子:61
专家分:0
注 册:2004-5-20
收藏
得分:0 
如果是我GF,我绝对不会让她受这个哭,帮她没商量
2004-12-29 09:10
live41
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:67
帖 子:12442
专家分:0
注 册:2004-7-22
收藏
得分:0 
呵呵,就算不是你GF,也帮她一下吧。小弟忙考试没空看,代码太长了。
2004-12-29 11:02
Knocker
Rank: 8Rank: 8
等 级:贵宾
威 望:47
帖 子:10454
专家分:603
注 册:2004-6-1
收藏
得分:0 
以下是引用断线风筝在2004-12-29 09:10:50的发言: 如果是我GF,我绝对不会让她受这个哭,帮她没商量
那有什么?如果是我GF,不但她不会,而且她的八大姨,七大姑,九大友的活儿我也一并包下!

九洲方除百尺冰,映秀又遭蛮牛耕。汽笛嘶鸣国旗半,哀伤尽处是重生。     -老K
治国就是治吏。礼义廉耻,国之四维。四维不张,国之不国。   -毛泽东
2004-12-29 11:22
时空之蕊
Rank: 2
等 级:新手上路
威 望:3
帖 子:691
专家分:0
注 册:2004-10-31
收藏
得分:0 
我就拿回去研究一下!
呵呵!好久没来了!

我渴望掌控时空的核心——用最先进的技术,打造无比美丽的世界!
2004-12-29 12:02
快速回复:[转帖][求助]请高手帮我修改一下这个程序,谢谢了!
数据加载中...
 
   



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

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