第一篇:C語言課程設(shè)計(jì)火車票系統(tǒng)源代碼
#include
//編號(hào)// char name[20];
//起點(diǎn)和終點(diǎn)// char time[5];
//出發(fā)時(shí)間// int price;
//車票價(jià)格// int amount;
//剩余數(shù)量// struct Node *next;}Node;//創(chuàng)建鏈表并輸入數(shù)據(jù)// struct Node *creat(){ struct Node *head,*r,*s;
int i=0;
char choice;
head=(struct Node *)malloc(sizeof(struct Node));head->next=NULL;r=head;do {
s=(struct Node *)malloc(sizeof(struct Node));s->next=NULL;printf(“請(qǐng)輸入第%d種火車票的信息:n”,++i);printf(“請(qǐng)輸入火車的編號(hào):”);
scanf(“%d”,&s->num);
printf(“起點(diǎn)和終點(diǎn):”);scanf(“%s”,s->name);printf(“出發(fā)時(shí)間:”);scanf(“%s”,s->time);printf(“車票價(jià)格:”);scanf(“%d”,&s->price);printf(“剩余數(shù)量:”);scanf(“%d”,&s->amount);
r->next=s;
r=s;
printf(“Continue?(Y/N)”);scanf(“%s”,&choice);}while(choice=='Y'||choice=='y');
r->next=NULL;return(head);} //將單鏈表中的信息保存到文件1.txt中// void save(struct Node *h){
struct Node *s;FILE *fp;
char filename[10]=“1.txt”;
fp=fopen(“1.txt”,“wt”);if(fp==NULL){
printf(“n寫文件出錯(cuò),按任意鍵退出!”);getchar();exit(1);}
for(s=h->next;s!=NULL;s=s->next)
fprintf(fp,“%d %s %s %d %d n”,s->num,s->name,s->time,s->price,s->amount);
getchar();fclose(fp);} // 從文件1.txt中讀取信息并存入單鏈表中// struct Node *read(){ struct Node *head,*r,*s;FILE *fp;char filename[10]=“zl.txt”;fp=fopen(“1.txt”,“rt”);if(fp==NULL){
printf(“讀文件錯(cuò)誤,按任意鍵退出!”);getchar();exit(1);} head=(struct Node *)malloc(sizeof(struct Node));head->next=NULL;r=head;while(!feof(fp)){
s=(struct Node *)malloc(sizeof(struct Node));fscanf(fp,“%d %s %s %d %d”,&s->num,s->name,s->time,&s->price,&s->amount);
r->next=s;r=s;
} r->next=NULL;fclose(fp);
return head;} //將鏈表中的數(shù)據(jù)輸出// void print(struct Node *h){
struct Node *s;
printf(“n火車票信息如下:n”);
printf(“~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~n”);printf(“編號(hào)
起點(diǎn)和終點(diǎn)
出發(fā)時(shí)間
車票價(jià)格
剩余票數(shù):n”);
for(s=h->next;s->next!=NULL;s=s->next){ printf(“ %d
%10s
%5s %10d %6dn”,s->num,s->name,s->time,s->price,s->amount);} } //鏈表查詢// struct Node * find(struct Node *h){ int i,j;char s[20];printf(“tt
查詢方法有以下幾種:n”);printf(“tt
1.火車票編號(hào)n”);printf(“tt
2.起點(diǎn)和終點(diǎn)n”);printf(“tt
3.出發(fā)時(shí)間n”);printf(“tt
4.車票價(jià)格n”);printf(“tt
5.剩余票數(shù)n”);printf(“請(qǐng)輸入您要查詢的方法的序號(hào):”);scanf(“%d”,&i);switch(i){ case 1:printf(“請(qǐng)輸入你要查詢火車票的編號(hào):”);scanf(“%d”,&j);
while(h->next!=NULL)
{
h=h->next;
if(h->num==j)return h;
}
return NULL;break;case 2:printf(“請(qǐng)輸入您要查詢火車票的起點(diǎn)和終點(diǎn):”);scanf(“%s”,s);while(h->next!=NULL){
h=h->next;if(strcmp(h->name,s)==0)
return h;
} return NULL;break;case 3:printf(“請(qǐng)輸入您要查詢火車票的時(shí)間:”);
scanf(“%s”,s);
while(h->next!=NULL)
{
h=h->next;
if(strcmp(h->time,s)==0)
return h;
}
return NULL;
break;case 4:printf(“請(qǐng)輸入你要查詢火車票的價(jià)格 :”);scanf(“%d”,&j);
while(h->next!=NULL)
{
h=h->next;
if(h->price==j)
return h;
}
return NULL;
break;case 5:printf(“請(qǐng)輸入你要查詢火車票的剩余票數(shù):”);scanf(“%d”,&j);
while(h->next!=NULL)
{
h=h->next;
if(h->amount==j)
return h;
} return NULL;
break;} } //修改信息// change(struct Node *h,int k){ int j;struct Node *p;p=find(h);printf(“------------n”);printf(“t
您要修改哪一項(xiàng)?n”);printf(“t
1.火車編號(hào)n”);printf(“t
2.起點(diǎn)和終點(diǎn)n”);printf(“t
3.出發(fā)時(shí)間n”);printf(“t
4.車票價(jià)格n”);
printf(“t
5.剩余票數(shù)n”);printf(“t
0.退出系統(tǒng)n”);
printf(“------------n”);printf(“請(qǐng)輸入您要修改項(xiàng)的編號(hào):”);scanf(“%d”,&j);switch(j)
{ case 1:
printf(“修改后的火車編號(hào):”);
scanf(“%d”,&p->num);
break;
case 2:
printf(“修改后的起點(diǎn)和終點(diǎn):”);
scanf(“%s”,p->name);
break;
case 3:
printf(“修改后的出發(fā)時(shí)間:”);
scanf(“%s”,p->time);
break;
case 4:
printf(“修改后的車票價(jià)格:”);
scanf(“%d”,&p->price);
break;
case 5:
printf(“修改后的剩余票數(shù):”);
scanf(“%d”,&p->amount);
break;
case 0:break;} } //刪除信息// delete(struct Node *h){ struct Node *p;
int j;
printf(“請(qǐng)輸入您要?jiǎng)h除的火車票的編號(hào):”);scanf(“%d”,&j);p=h->next;
if(p==NULL)
return 0;while(p!=NULL){ if(p->num==j){
h->next=p->next;
free(p);
return 1;} h=p;p=p->next;
} return 0;} //添加信息// void append(){
struct Node *p;
FILE *fp;
fp=fopen(“1.txt”,“at+”);
if(fp==NULL)
{
printf(“寫文件出錯(cuò),按任意鍵返回.n”);getchar();exit(1);
}
printf(“請(qǐng)輸入要添加的火車票的信息:火車編號(hào),起點(diǎn)和終點(diǎn),出發(fā)時(shí)間,車票價(jià)格,剩余票數(shù):n”);scanf(“%d%s%s%d%d”,&p->num,p->name,p->time,&p->price,&p->amount);fprintf(fp,“%d %s %s %d %dn”,p->num,p->name,p->time,p->price,p->amount);getchar();fclose(fp);} //數(shù)據(jù)的統(tǒng)計(jì)// void count(struct Node *h){ struct Node *s;s=h;int i,j,k,n=0;printf(“*****************************************************************************n”);
printf(“tt
請(qǐng)選擇您要統(tǒng)計(jì)項(xiàng)目的序號(hào):n”);
printf(“tt
1.車票價(jià)格n”);
printf(“tt
2.剩余票數(shù)n”);printf(“tt
0.退出界面n”);
scanf(“%d”,&i);switch(i)
{
case 1:
printf(“請(qǐng)輸入您要統(tǒng)計(jì)車票的價(jià)格的標(biāo)準(zhǔn):”);
scanf(“%d”,&j);
printf(“tt
請(qǐng)選擇低于或高于標(biāo)準(zhǔn):n”);
printf(“tt
1.價(jià)格低于%d的個(gè)數(shù)n”,j);
printf(“tt
2.價(jià)格高于%d的個(gè)數(shù)n”,j);
scanf(“%d”,&k);
if(k==1)
{
for(s=h->next;s->next!=NULL;s=s->next)
if(s->price n++; printf(“車票價(jià)格低于%d的個(gè)數(shù)有%d個(gè).n”,j,n); } else { for(s=h->next;s->next!=NULL;s=s->next) if(s->price>j) n++; printf(“車票價(jià)格低于%d的個(gè)數(shù)有%d個(gè).n”,j,n); } break; case 2: printf(“請(qǐng)輸入您要統(tǒng)計(jì)剩余票數(shù)的數(shù)量:”); scanf(“%d”,&j); printf(“tt 請(qǐng)選擇低于或高于所輸票數(shù):n”); printf(“tt 1.票數(shù)低于%d的個(gè)數(shù)n”,j); printf(“tt 2.票數(shù)高于%d的個(gè)數(shù)n”,j); scanf(“%d”,&k); if(k==1) { for(s=h->next;s->next!=NULL;s=s->next) if(s->amount n++; printf(“剩余票數(shù)低于%d的個(gè)數(shù)有%d個(gè).n”,j,n); } else { for(s=h->next;s->next!=NULL;s=s->next) if(s->amount>j) n++; printf(“剩余票數(shù)高于%d的個(gè)數(shù)有%d個(gè).n”,j,n); } break; case 0:break; } } //保存用戶和密碼到文件2.txt中// void save_user(){ char file[10]=“2.txt”;FILE *fp;char name[20];char pwd[10];fp=fopen(“2.txt”,“at+”);if(fp==NULL){ printf(“n寫文件出錯(cuò),按任意鍵退出.n”); getchar();exit(1);} printf(“請(qǐng)輸入用戶名:”); scanf(“%s”,name);printf(“請(qǐng)輸入密碼:”); scanf(“%s”,pwd); fprintf(fp,“%s %sn”,name,pwd); getchar(); fclose(fp); printf(“用戶注冊(cè)成功!n”);} //檢驗(yàn)用戶和密碼是否匹配// int check(char *name,char *pwd){ char name1[20];char pwd1[10];FILE *fp;char file[10]=“2.txt”;if((fp=fopen(“2.txt”,“rt”))==NULL){ printf(“讀文件出錯(cuò),按任意鍵退出!n”); getchar(); exit(1);} while(!feof(fp)){ fscanf(fp,“%s %s”,name1,pwd1); if(strcmp(name1,name)==0&&strcmp(pwd1,pwd)==0) return 1;} return 0;} //數(shù)據(jù)排序// void sort(struct Node *h){ struct Node *s,*p,*m,*n;int t,t1,t2,t3;char s1[20];char s2[10]; printf(“車票價(jià)格由小到大排序如下:n”);for(s=h->next;s->next!=NULL;s=s->next)for(p=s->next;p->next!=NULL;p=p->next) if(s->price>p->price) { t1=s->num;s->num=p->num;p->num=t1; t2=s->price;s->price=p->price;p->price=t2; t3=s->amount;s->amount=p->amount;p->amount=t3; strcpy(s1,s->name);strcpy(s->name,p->name);strcpy(p->name,s1); strcpy(s2,s->time);strcpy(s->time,p->time);strcpy(p->time,s2); } print(h);printf(“nn剩余車票數(shù)量由多到少排序如下:n”);for(s=h->next;s->next!=NULL;s=s->next) for(p=s->next;p->next!=NULL;p=p->next) if(s->amount amount) { t1=s->num;s->num=p->num;p->num=t1; t2=s->price;s->price=p->price;p->price=t2; t3=s->amount;s->amount=p->amount;p->amount=t3; strcpy(s1,s->name);strcpy(s->name,p->name);strcpy(p->name,s1); strcpy(s2,s->time);strcpy(s->time,p->time);strcpy(p->time,s2); } print(h);} void main(){ struct Node *head,*p;int i,j,k;head=(struct Node *)malloc(sizeof(struct Node));head->next=NULL;char name[20];char pwd[10];printf(“n***************歡迎進(jìn)入火車票管理系統(tǒng)******************n”);printf(“tt 1.用戶登錄n”);printf(“tt 2.用戶注冊(cè)n”);printf(“tt 0.退出系統(tǒng) n”);printf(“請(qǐng)輸入所選序號(hào):”);scanf(“%d”,&k); switch(k){ case 1: printf(“請(qǐng)輸入用戶名:”); scanf(“%s”,name); printf(“請(qǐng)輸入密碼:”); scanf(“%s”,pwd); if(check(name,pwd)) { printf(“密碼正確.n”); do { printf(“nntt*********************歡迎進(jìn)入火車票管理系統(tǒng)***********************n”); printf(“tt 1.錄入火車票信息tt 2.添加火車票信息n”); printf(“tt 3.修改火車票信息tt 4.刪除火車票信息n”); printf(“tt 5.打印火車票信息tt 6.查詢火車票信息n”); printf(“tt 7.統(tǒng)計(jì)火車票信息tt 8.火車票銷售排行n”); printf(“tt 0.退出系統(tǒng)n”); printf(“請(qǐng)輸入您要進(jìn)入菜單的序號(hào)(0-8):”); scanf(“%d”,&i); switch(i) { case 1: printf(“請(qǐng)錄入火車票信息nn”); head=creat(); save(head); head=read(); break; case 2: append(); break; case 3: printf(“請(qǐng)輸入您要修改的火車票的編號(hào):”); scanf(“%d”,&j); change(head,j); save(head); break; case 4: head=read(); if(delete(head)) { printf(“已正確刪除!n”); save(head); } else printf(“要?jiǎng)h除的結(jié)點(diǎn)不存在!n”); break; case 5: head=read(); print(head); break; case 6: printf(“請(qǐng)輸入您要查詢火車票的編號(hào)(以0結(jié)束):”); scanf(“%d”,&j); { p=find(head); printf(“編號(hào) 起點(diǎn)和終點(diǎn) 出發(fā)時(shí)間 車票價(jià)格 剩余票數(shù):n”); printf(“%d %10s %5s %10d %6dn”,p->num,p->name,p->time,p->price,p->amount); printf(“請(qǐng)繼續(xù)輸入序號(hào)(以0結(jié)束):”); scanf(“%d”,&j); } break; case 7: head=read();count(head);break; case 8: sort(head);break; case 0: printf(“************************用!*****************************n”);break; } }while(i!=0); } else printf(“密碼錯(cuò)誤或用戶名不存在.n”); break;case 2:save_user();break;case 0:break;} 謝 謝 使 #include //包含access函數(shù)的頭文件 #define N 9999 //定義最多的航班數(shù) #define PRINT “%dtt%stt%stt星期%stt%dn ”,s[i].num,s[i].start,s[i].over,s[i].time,s[i].count //宏定義輸出格式 struct air //定義結(jié)構(gòu)體數(shù)組 { int num; //定義航班號(hào) char start[20];//航班起始站 char over[20];//終點(diǎn)站 char time[10];//飛行時(shí)間 int count; //機(jī)票數(shù)量 }s[N]; int i,m=0; //定義全局變量 char ii[10]; void add();//函數(shù)聲明增加航班信息函數(shù) void print(); //顯示航班信息 void search();//查找航班信息 void dingpiao();//訂票業(yè)務(wù) void tuipiao();//退票 void read();//讀取文件 void save();//保存文件 void output();//輸出格式 void paixu();//航班排序 void chushihua();//系統(tǒng)初始化 void build();//建立數(shù)據(jù)文件 void paixu1();//按航班號(hào)從小到大排序 void paixu2();//從大到小 void main()//主函數(shù) { int j; chushihua();//系統(tǒng)初始化判斷是否存在原始數(shù)據(jù)文件 printf(“ 歡迎使用飛機(jī)訂票系統(tǒng)n”);//打印出系統(tǒng)主界面 do { printf(“================================== ”); printf(“1.增加航班信息n” “t2.瀏覽航班信息n” “tt3.查找航班信息(按航班號(hào))tt╮(╯_╰)╭n” “ttt4.航班排序(按航班號(hào))n” “tttt5.訂票業(yè)務(wù)n” “to(︶︿︶)ottt6.退票業(yè)務(wù)n” “tttttt0.退出n”);printf(“================================== ”); printf(“請(qǐng)?jiān)?-6中選擇以回車鍵結(jié)束: ”);scanf(“%d”,&j);switch(j){ case 1: add();//調(diào)用增加航班函數(shù) break; case 2:print();//調(diào)用顯示模塊 break; case 3:search();//調(diào)用查找模塊 break; case 4:paixu();//調(diào)用排序函數(shù) break; case 5:dingpiao();//調(diào)用訂票模塊 break; case 6:tuipiao();//調(diào)用退票模塊 break; case 0: //退出系統(tǒng) save(); printf(“謝謝使用,再見!”); break;} }while(j!=0);//判斷是否調(diào)用其他函數(shù) } void chushihua()//定義系統(tǒng)初始化函數(shù) { if(access(“hangban.dat”,0)){ build();} else read();} void build()//定義建立數(shù)據(jù)文件函數(shù) { FILE *fp;//定義文件指針 if((fp=fopen(“hangban.dat”,“wb”))==NULL)//打開文件并判定是否出錯(cuò) { printf(“創(chuàng)建文件失敗!”);//打印出錯(cuò)提示 getchar(); return;} printf(“請(qǐng)依次輸入航班信息(以回車鍵結(jié)束):n”); //打印提示信息 printf(“------------n”);for(i=0;i printf(“請(qǐng)輸入航班號(hào): ”); scanf(“%d”,&s[i].num);//輸入航班號(hào) printf(“請(qǐng)輸入起始站: ”); scanf(“%s”,s[i].start);//輸入起始站 printf(“請(qǐng)輸入終點(diǎn)站: ”); scanf(“%s”,s[i].over);//輸入終點(diǎn)站 printf(“請(qǐng)輸入時(shí)間(星期幾): ”); scanf(“%s”,s[i].time);//輸入時(shí)間 printf(“請(qǐng)輸入機(jī)票數(shù): ”); scanf(“%d”,&s[i].count);//輸入機(jī)票數(shù) fwrite(&s[i],sizeof(struct air),1,fp); m++; printf(“添加完畢,是否繼續(xù)添加?請(qǐng)鍵入y或n以回車鍵結(jié)束:”); scanf(“%s”,ii); if(strcmp(ii,“y”)!=0) //判斷是否繼續(xù)添加航班信息 { fclose(fp); //關(guān)閉文件 return; } } } void read() //定義讀取文件函數(shù) { FILE *fp;if((fp=fopen(“hangban.dat”,“r”))==NULL){ printf(“創(chuàng)建文件失敗!”); getchar(); return;} i=0;while(!feof(fp)){ fread(&s[i],sizeof(struct air),1,fp);//逐塊讀取數(shù)據(jù) i++; m++;//計(jì)算存在航班數(shù) } m--;fclose(fp);} void save()//定義保存函數(shù) { FILE *fp;if((fp=fopen(“hangban.dat”,“wb”))==NULL) { printf(“創(chuàng)建文件失敗!”); getchar(); return;} for(i=0;i //逐塊保存數(shù)據(jù) fwrite(&s[i],sizeof(struct air),1,fp);fclose(fp);} void add()//定義增加航班信息函數(shù) { do{ printf(“請(qǐng)依次輸入您要增加的航班信息(以回車鍵結(jié)束): n”); //打印提示信息 printf(“------------n”); printf(“請(qǐng)輸入航班號(hào): ”); scanf(“%d”,&s[m].num);//讀取航班號(hào) printf(“請(qǐng)輸入起始站: ”); scanf(“%s”,s[m].start);//讀取起始站 printf(“請(qǐng)輸入終點(diǎn)站: ”); scanf(“%s”,s[m].over);//讀取終點(diǎn)站 printf(“請(qǐng)輸入時(shí)間: ”); scanf(“%s”,s[m].time);//讀取時(shí)間 printf(“請(qǐng)輸入機(jī)票數(shù): ”); scanf(“%d”,&s[m].count);//讀取機(jī)票數(shù) m++; printf(“添加完畢,是否繼續(xù)添加?請(qǐng)鍵入y或n以回車鍵結(jié)束:”); scanf(“%s”,ii);}while(!strcmp(ii,“y”));//判斷是否繼續(xù)添加 } void output()//定義輸出格式函數(shù) { printf(“航班號(hào)tt起始站tt終點(diǎn)站tt時(shí)間tt機(jī)票數(shù)n”);//信息標(biāo)題 for(i=0;i printf(PRINT);//打印出信息 } void print()//定義顯示航班信息函數(shù) { printf(“n目前我們有如下航班:n”);output(); //調(diào)用輸出格式函數(shù) printf(“n請(qǐng)按回車鍵返回上層菜單 ”);getchar();getchar();} void search()//定義查詢函數(shù) { int n; do { printf(“n請(qǐng)輸入航班號(hào): ”); scanf(“%d”,&n);//輸入查詢的航班號(hào) for(i=0;i { if(s[i].num==n)//按航班號(hào)判定輸出條件 { printf(“n您所查找的航班信息為:n ”); printf(“航班號(hào)tt起始站tt終點(diǎn)站tt時(shí)間tt機(jī)票數(shù) nn”); printf(PRINT);//顯示信息 printf(“n查詢完畢,按回車鍵繼續(xù)”); getchar(); getchar(); return; } } printf(“n對(duì)不起,沒有您需要的信息!n ”);printf(“是否重新查找?請(qǐng)鍵入y或n以回車鍵結(jié)束 ”);scanf(“%s”,ii);}while(!strcmp(ii,“y”));//判定是否重新查找 } void dingpiao()//定義訂票業(yè)務(wù)函數(shù) { int n;char a[10]=“y”;do { search();//調(diào)用查詢模塊 if(!strcmp(ii,“n”)) { printf(“對(duì)不起!沒有找到您所需要的航班,所以不能訂票。n”);//未查找到所需航班 printf(“n請(qǐng)按回車鍵返回上層菜單 ”); getchar(); getchar(); strcpy(ii,“n”); break; } do { printf(“請(qǐng)輸入您要訂的機(jī)票數(shù)(以回車鍵結(jié)束): ”); scanf(“%d”,&n);//輸入所訂機(jī)票數(shù) if(n<=0) //判定機(jī)票數(shù)是否出錯(cuò) { printf(“輸入錯(cuò)誤!至少需訂1張機(jī)票。n”); } else if(s[i].count==0)//判定機(jī)票是否售完 { printf(“對(duì)不起,你所選擇的航班的機(jī)票已售完!n”); break; } else if(s[i].count!=0&&s[i].count>=n)//判定機(jī)票數(shù)是否大于等于訂票數(shù) { s[i].count=s[i].count-n; printf(“訂票成功!”); break; } else if(s[i].count { printf(“對(duì)不起,你所選擇的航班只剩 %d張機(jī)票n”, s[i].count); printf(“是否需要重新輸入機(jī)票數(shù)?請(qǐng)輸入y或n以回車鍵結(jié)束: ”);//判定是否重新輸入訂票數(shù) scanf(“%s”,a); } }while(!strcmp(a,“y”)); printf(“是否需要訂其他航班的機(jī)票?請(qǐng)輸入y或n以回車鍵結(jié)束: ”); scanf(“%s”,a);}while(!strcmp(a,“y”));//判定是否繼續(xù)訂票 } void tuipiao()//定義退票函數(shù) { int n;char a[10];do { search();//調(diào)用查詢函數(shù) if(!strcmp(ii,“n”)) { printf(“對(duì)不起!沒有找到您所需要的航班,所以不能退票。n”); printf(“n請(qǐng)按回車鍵返回上層菜單 ”); getchar(); getchar(); strcpy(ii,“n”); break; } printf(“請(qǐng)輸入您要退的機(jī)票數(shù)目: ”); scanf(“%d”,&n);//輸入所退票數(shù) if(n<=0) //判定票數(shù)是否有效 printf(“輸入錯(cuò)誤!至少需退1張機(jī)票。”); else { s[i].count=s[i].count+n; printf(“退票成功!”); } printf(“是否繼續(xù)? 請(qǐng)鍵入y或n以回車鍵結(jié)束: ”);//判定是否繼續(xù)退票 scanf(“%s”,a);}while(!strcmp(a,“y”));//判定并跳出循環(huán) } void paixu()//定義排序函數(shù) { int n; printf(“n******************************************************************************** ”); printf(“1.按航班號(hào)從小到大排序n” “t2.按航班號(hào)從大到小排序n”);printf(“******************************************************************************** ”); printf(“請(qǐng)?jiān)?-2中選擇以回車鍵結(jié)束: ”);scanf(“%d”,&n);//輸入排序方式 switch(n){ case 1:paixu1();//調(diào)用從小到大排序函數(shù) break; case 2:paixu2();//調(diào)用從大到小排序函數(shù) break;} printf(“排序后的航班信息為:n”);output(); //顯示排序后航班信息 printf(“n請(qǐng)按回車鍵返回上層菜單 ”); getchar(); getchar();} void paixu1()//定義從小到大排序函數(shù) { int k,j;struct air t;for(i=0;i { k=i; for(j=i+1;j if(s[k].num>s[j].num) k=j; if(i!=k) { t=s[k]; s[k]=s[i]; s[i]=t; } } } void paixu2()//定義從大到小排序函數(shù) { } int k,j;struct air t;for(i=0;i if(s[k].num k=j;if(i!=k){ t=s[k]; s[k]=s[i]; s[i]=t;} } 課 程 設(shè) 計(jì) 課程設(shè)計(jì)名稱: C語言程序設(shè)計(jì) 題 目:學(xué)籍管理系統(tǒng) 學(xué) 生 姓 名: 學(xué)生學(xué)號(hào) : 學(xué) 院(系): 軟件學(xué)院 專 業(yè) 班 級(jí): 112021 指 導(dǎo) 教 師: 設(shè)計(jì)時(shí)間: 2012 年 9 月 日 ? 2012 年 9月_ 14 日 實(shí)驗(yàn)題目:學(xué)籍管理系統(tǒng)一、實(shí)驗(yàn)?zāi)康?/p> 綜合應(yīng)用所學(xué)的C語言程序設(shè)計(jì)知識(shí),自行設(shè)計(jì)并實(shí)現(xiàn)一個(gè)較為完整的小型管理信息系統(tǒng)。通過系統(tǒng)分析、系統(tǒng)設(shè)計(jì)、編程實(shí)現(xiàn),寫實(shí)驗(yàn)報(bào)告等環(huán)節(jié),初步掌握軟件系統(tǒng)的設(shè)計(jì)方法和步驟,提高靈活運(yùn)用程序語言進(jìn)行軟件開發(fā)的技能,提高程序設(shè)計(jì)水平和分析問題、解決問題的能力。 二、實(shí)驗(yàn)內(nèi)容 1):熟悉C語言的開發(fā)環(huán)境,按照給定的上機(jī)步驟練習(xí)完成; 2):熟悉C程序的編輯,編譯,鏈接和運(yùn)行的過程。3):編譯一個(gè)應(yīng)用系統(tǒng)程序,形成一個(gè)軟件系統(tǒng)。 三.實(shí)驗(yàn)要求 1.1、分析系統(tǒng)功能 (1)用戶進(jìn)入主菜單后,就會(huì)在看到,菜單選項(xiàng)中添加有系統(tǒng)的各項(xiàng)功能,進(jìn)入的 應(yīng)的選項(xiàng)就可進(jìn)行相應(yīng)的操作.其主要功能有: 1、錄入學(xué)生信息 2、刪除學(xué)生信息 3、查詢學(xué)生信息 4、學(xué)生信息排序 5、改學(xué)生信息 6、保存退出系統(tǒng) (2)用戶選擇所需操作的選項(xiàng),進(jìn)入相應(yīng)的操作界面,在這里用戶就可開始進(jìn)行操作。 四、使用說明 學(xué)生學(xué)籍管理系統(tǒng)是針對(duì)學(xué)生信息的管理,主要功能是添加學(xué)生信息、刪除學(xué)生信息、查詢學(xué)生信息、學(xué)生信息排序、修改學(xué)生信息、保存信息。 1,用戶打開程序,進(jìn)入主界面,輸入學(xué)生信息如圖 2,按回車進(jìn)入主菜單,列出各項(xiàng)功能如圖 輸入1,是查詢整個(gè)班級(jí)的學(xué)生的信息,如圖 輸入2,是查詢個(gè)別學(xué)生的信息,如查詢第一學(xué)生的信息,如圖 輸入3,是刪除個(gè)別學(xué)生的信息,如刪除第一個(gè)學(xué)生,如圖 輸入4,是插入某些學(xué)生的信息,如插入第三個(gè),如圖 輸入5,是修改某個(gè)同學(xué)的信息,如刪除第一個(gè),如圖 三、心得體會(huì) 兩周的課程過起來其實(shí)也是很快的。這是我第一次做課程設(shè)計(jì),起初還沒做的時(shí)候覺得很快自己就將得編一個(gè)較大的程序,將會(huì)很有意思。帶著最初的好奇心,新鮮感就這樣開始了第一天的編程,結(jié)果是大失所望。做課程設(shè)計(jì)并不是自己想象中的那樣有意思,而是很枯燥,很乏味的。也沒想象中的那樣簡單,并不是像我們平時(shí)上C語言課時(shí),每次編的那些小程序,沒那么簡單。我們現(xiàn)在要做的就是將我們平時(shí)學(xué)的,做的那些小程序都合理的湊到一塊兒來。而把這些小程序都加到一塊兒來,并不是隨意的將它們放到一個(gè)程序中就完事的,而是必須得合理,且得顧及到各個(gè)方面。 正是由于編程的紛繁復(fù)雜,且結(jié)構(gòu)的嚴(yán)謹(jǐn),因此編程的過程中到處是困難和問題。它考驗(yàn)的不僅是我們的平時(shí)用功程度,以及我們對(duì)所學(xué)知識(shí)的熟練掌握程度、應(yīng)用的靈活程度,它還考驗(yàn)我們的毅力。在剛開始的幾天時(shí),由于前一陣忙于各科的考試,C語言已經(jīng)好久沒碰了,所學(xué)的知識(shí)都有點(diǎn)遺忘了,在編寫時(shí)處處碰壁,一直會(huì)停頓翻書,編得自己都開始心煩意亂了,實(shí)在是編不下去了,于是索性就停了三天去看書,先把書給吃透。并在后期的程序調(diào)試中也碰到不少的問題,好多問題自己反復(fù)檢查了幾遍都沒查出,但在老師的幫助下還是一下就查出了。并不是這些問題多難,而是不夠心細(xì)。因此做課程設(shè)計(jì)、編程時(shí),它還考驗(yàn)并鍛煉我們的心細(xì)程度。 經(jīng)過這次的課程設(shè)計(jì)的實(shí)踐,我受益頗多,不僅是對(duì)我掌握知識(shí)、靈活運(yùn)用知識(shí)的一次考驗(yàn)和鍛煉,也是對(duì)我生活態(tài)度的一次鍛煉,讓我學(xué)會(huì)心細(xì)和擁有毅力,更具信心和恒心,碰到困難不再退縮,而是堅(jiān)強(qiáng)面對(duì)。 四,程序編碼 /*做一個(gè)學(xué)生的學(xué)籍管理系統(tǒng),有輸入,查詢,刪除,增加,修改等功能*/ #include #include /*聲明數(shù)組的大小,可以任意改動(dòng)*/ int board[50][50];/*聲明一個(gè)表格的數(shù)組*/ int cur_x, cur_y;/*定義坐標(biāo)*/ void init();/*聲明一個(gè)初始化界面的函數(shù)*/ void clear();/*清除界面的函數(shù)*/ void draw_board();/*聲明一個(gè)函數(shù)畫表格*/ struct student{/*創(chuàng)建一個(gè)學(xué)生的結(jié)構(gòu)體*/ char stuNo[8]; /*學(xué)生的學(xué)號(hào)*/ char name[10];/*學(xué)生的姓名*/ char sex[2];/*學(xué)生的性別*/ char score[4]; /*學(xué)生的分?jǐn)?shù)*/ char address[10];/*學(xué)生的地址*/ };void init()/*初始化函數(shù)*/ { int gdriver, gmode, i, j; gdriver = DETECT;/*圖形界面的驅(qū)動(dòng)聲明*/ registerbgidriver(EGAVGA_driver); initgraph(&gdriver, &gmode, “"); for(i = 0;i < 10;i ++) for(j = 0;j < 10;j++)/*聲明坐標(biāo)的間距*/ board[i][j] = 0; cur_x = 1; cur_y = 1;} void destroy()/*關(guān)閉圖形驅(qū)動(dòng)器*/ { closegraph();} void draw_board(int n)/*畫表格的函數(shù)*/ { int i, j; for(i = 20;i <=5*160+80;i += 90)/*劃橫線的循環(huán)*/ { line(i, 20, i,(n+1)*60+20); } for(i = 20;i <=(n+1)*60+30;i += 60)/*劃縱線的循環(huán)*/ { line(20, i, 5*110+10, i); } } void main(){ struct student stu[SIZE],stu_temp;/*聲明結(jié)構(gòu)體變量*/ FILE *fp; /*聲明文件型的指針*/ int i,j,n,m,h; int c=1;/*c為循環(huán)次數(shù)*/ h=0; fp=fopen(”c:list.txt“,”wb+“);/*打開寫入文件*/ init();/*調(diào)用函數(shù)*/ draw_board(SIZE); if(fp==NULL)/*驗(yàn)證文件是否為空*/ { printf(”cannot open this filen“); exit(0); } printf(”input all %d students's data.n“,SIZE);/*畫輸入學(xué)生信息的表*/ gotoxy(17,4); printf(”stuNo“); gotoxy(29,4); printf(”name“); gotoxy(41,4); printf(”sex“); gotoxy(52,4); printf(”score“); gotoxy(63,4); printf(”address“); for(i=0;i { gotoxy(7,4*(i+2)); printf(”%d“,i); gotoxy(17,4*(i+2)); scanf(”%s“,&stu[i].stuNo); gotoxy(29,4*(i+2)); scanf(”%s“,&stu[i].name); gotoxy(41,4*(i+2)); scanf(”%s“,&stu[i].sex); gotoxy(52,4*(i+2)); scanf(”%s“,&stu[i].score); gotoxy(63,4*(i+2)); scanf(”%s“,&stu[i].address); } for(i=0;i if(fwrite(&stu[i],sizeof(struct student),1,fp)!=1) { printf(”file write error!“); exit(0); } rewind(fp); clrscr(); for(c=1;c<100;c++)/*創(chuàng)建一個(gè)圖形界面*/ { textbackground(0); textcolor(1); gotoxy(29,7); printf(”read->1“); gotoxy(29,9); printf(”find->2“); gotoxy(29,11); printf(”delete->3“); gotoxy(29,13); printf(”insert->4“); gotoxy(29,15); printf(”modify->5“); gotoxy(29,17); printf(”plese enter j= “); scanf(”%d“,&j); clrscr(); if(j==1)/*當(dāng)輸入為1時(shí),顯示整個(gè)班級(jí) {的學(xué)生信息*/ draw_board(SIZE); gotoxy(17,4); printf(”stuNo“); gotoxy(29,4); printf(”name“); gotoxy(41,4); printf(”sex“); gotoxy(52,4); printf(”score“); gotoxy(63,4); printf(”address“); for(i=0;i { fread(&stu_temp,sizeof(struct student),1,fp);出每個(gè)學(xué)生的信息*/ gotoxy(7,4*(i+2)); printf(”%d“,i); gotoxy(17,4*(i+2)); printf(”%s“,stu[i].stuNo); gotoxy(29,4*(i+2)); printf(”%s“,stu[i].name); gotoxy(41,4*(i+2)); printf(”%s“,stu[i].sex); gotoxy(52,4*(i+2)); printf(”%s“,stu[i].score); gotoxy(63,4*(i+2)); printf(”%s“,stu[i].address); } fclose(fp); /*關(guān)閉文件*/ getch();/*留在當(dāng)前界面*/ clrscr();/*清屏*/ } if(j==2)/*當(dāng)輸入為2時(shí),查找某個(gè)學(xué)生的 {信息*/ rewind(fp);/*移動(dòng)指針到最前*/ printf(”look up the nth(n<4)student,plese enter n= :n“);/*輸入要查找的學(xué)生 scanf(”%d“,&i);位置*/ clrscr(); draw_board(1);/*畫表格*/ gotoxy(17,4); printf(”stuNo“); gotoxy(29,4); printf(”name“); gotoxy(41,4); printf(”sex“); gotoxy(52,4); printf(”score“); gotoxy(63,4); printf(”address“); fseek(fp,(i-1)*sizeof(struct student),0);/*打開文件查找,讀出信 fread(&stu_temp,sizeof(struct student),1,fp);息*/ gotoxy(7,8); printf(”%d“,i); gotoxy(17,8); printf(”%s“,stu[i].stuNo); gotoxy(29,8); printf(”%s“,stu[i].name); gotoxy(41,8); printf(”%s“,stu[i].sex); gotoxy(52,8); printf(”%s“,stu[i].score); gotoxy(63,8); printf(”%s“,stu[i].address); } fclose(fp); getch(); clrscr(); if(j==3)/*當(dāng)輸入為3,刪除某個(gè)學(xué)生的信息*/ { h=h-1;/*表格少畫一格*/ printf(”you want delete nth student,plese enter n= “); scanf(”%d“,&n); draw_board(SIZE+h);/*調(diào)用函數(shù)畫表格*/ gotoxy(17,4); printf(”stuNo“); gotoxy(29,4); printf(”name“); gotoxy(41,4); printf(”sex“); gotoxy(52,4); printf(”score“); gotoxy(63,4); printf(”address“); for(m=n;m { strcpy(stu[m].stuNo,stu[m+1].stuNo); strcpy(stu[m].name,stu[m+1].name); strcpy(stu[m].sex,stu[m+1].sex); strcpy(stu[m].score,stu[m+1].score); strcpy(stu[m].address,stu[m+1].address); } for(i=0;i { fread(&stu_temp,sizeof(struct student),1,fp);個(gè)表格*/ gotoxy(7,4*(i+2)); printf(”%d“,i); gotoxy(17,4*(i+2)); printf(”%s“,stu[i].stuNo); gotoxy(29,4*(i+2)); printf(”%s“,stu[i].name); gotoxy(41,4*(i+2)); printf(”%s“,stu[i].sex); gotoxy(52,4*(i+2)); printf(”%s“,stu[i].score); gotoxy(63,4*(i+2)); printf(”%s“,stu[i].address); } fclose(fp); getch(); clrscr(); } if(j==4)/*當(dāng)輸入為4時(shí),增加一個(gè)學(xué)生 {信息*/ h=h+1; printf(”you want insert nth student,plese enter n= “); scanf(”%d“,&n); for(m=n;m {息*/ strcpy(stu[m+1].stuNo,stu[m].stuNo); strcpy(stu[m+1].name,stu[m].name); strcpy(stu[m+1].sex,stu[m].sex); strcpy(stu[m+1].score,stu[m].score); strcpy(stu[m+1].address,stu[m].address); } draw_board(1);/*調(diào)用函數(shù)畫表格*/ gotoxy(7,4*2); printf(”%d“,n); gotoxy(17,4); printf(”stuNo“); gotoxy(29,4); printf(”name“); gotoxy(41,4); printf(”sex“); gotoxy(52,4); printf(”score“); gotoxy(63,4); printf(”address“); gotoxy(17,8);/*輸入一個(gè)新學(xué)生的 scanf(”%s“,&stu[n].stuNo);信息*/ gotoxy(29,8); scanf(”%s“,&stu[n].name); gotoxy(41,8); scanf(”%s“,&stu[n].sex); gotoxy(52,8); scanf(”%s“,&stu[n].score); gotoxy(63,8); scanf(”%s“,&stu[n].address); gotoxy(7,8); printf(”%d“,i); gotoxy(17,8); printf(”%s“,stu[n].stuNo); gotoxy(29,8); printf(”%s“,stu[n].name); gotoxy(41,8); printf(”%s“,stu[n].sex); gotoxy(52,8); printf(”%s“,stu[n].score); gotoxy(63,8); printf(”%s“,stu[n].address); clrscr(); draw_board(SIZE+h); gotoxy(17,4); printf(”stuNo“); gotoxy(29,4); printf(”name“); gotoxy(41,4); printf(”sex“); gotoxy(52,4); printf(”score“); gotoxy(63,4); printf(”address“); for(i=0;i { fread(&stu_temp,sizeof(struct student),1,fp);表格*/ gotoxy(7,4*(i+2)); printf(”%d“,i); gotoxy(17,4*(i+2)); printf(”%s“,stu[i].stuNo); gotoxy(29,4*(i+2)); printf(”%s“,stu[i].name); gotoxy(41,4*(i+2)); printf(”%s“,stu[i].sex); gotoxy(52,4*(i+2)); printf(”%s“,stu[i].score); gotoxy(63,4*(i+2)); printf(”%s“,stu[i].address); } fclose(fp); getch(); clrscr(); } if(j==5)/*當(dāng)輸入為5,修改某個(gè)學(xué)生 {信息*/ printf(”you want to modify nth student information,plese enter n= “); scanf(”%d“,&n); /*輸入修改的學(xué)生的位置*/ draw_board(1); draw_board(1); gotoxy(7,4*2); printf(”%d“,n); gotoxy(17,4); printf(”stuNo“); gotoxy(29,4); printf(”name“); gotoxy(41,4); printf(”sex“); gotoxy(52,4); printf(”score“); gotoxy(63,4); printf(”address“); gotoxy(17,8); /*輸入新的學(xué)生信息*/ scanf(”%s“,&stu[n].stuNo); gotoxy(29,8); scanf(”%s“,&stu[n].name); gotoxy(41,8); scanf(”%s“,&stu[n].sex); gotoxy(52,8); scanf(”%s“,&stu[n].score); gotoxy(63,8); scanf(”%s“,&stu[n].address); gotoxy(7,8); clrscr(); draw_board(SIZE); gotoxy(17,4); printf(”stuNo“); gotoxy(29,4); printf(”name“); gotoxy(41,4); printf(”sex“); gotoxy(52,4); printf(”score“); gotoxy(63,4); printf(”address“); for(i=0;i { fread(&stu_temp,sizeof(struct student),1,fp); gotoxy(7,4*(i+2)); printf(”%d“,i); gotoxy(17,4*(i+2)); printf(”%s“,stu[i].stuNo); gotoxy(29,4*(i+2)); printf(”%s“,stu[i].name); gotoxy(41,4*(i+2)); printf(”%s“,stu[i].sex); gotoxy(52,4*(i+2)); printf(”%s“,stu[i].score); gotoxy(63,4*(i+2)); printf(”%s",stu[i].address); } fclose(fp);/*關(guān)閉文件*/ getch();/*保留在這個(gè)界面上*/ clrscr();/*清屏*/ } } } 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 圖書管理系統(tǒng) 工程管理 121279044 伍楊 目錄一、二、三、題目要求...................................................................2 總體設(shè)計(jì)...................................................................2 編碼實(shí)現(xiàn)...................................................................3 1)定義圖書結(jié)構(gòu)體.......................................................3 2)登記操作...............................................................4 3)查看操作...............................................................8 4)刪除操作.............................................................11 5)Main函數(shù)...........................................................20四、五、六、調(diào)試與測試..............................................................26 五心得體會(huì)..............................................................28 用戶手冊(cè).................................................................28 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 一、題目要求 1)目的要求 本課程設(shè)計(jì)任務(wù)的目的是要求學(xué)生按照分析、設(shè)計(jì)、編碼、調(diào)試和測試的軟件開發(fā)過程獨(dú)立完成管理系統(tǒng)設(shè)計(jì),以及C語言算法的掌握,并能最終實(shí)現(xiàn)本系統(tǒng)的功能要求,通過這個(gè)程序可以學(xué)習(xí)到以前調(diào)試短程序沒有的的經(jīng)驗(yàn)。2)題目要求 實(shí)現(xiàn)圖書管理信息系統(tǒng)的設(shè)計(jì)。要求實(shí)現(xiàn)圖書添加、顯示全部圖書、查詢、借閱和歸還。主要考查利用文件的操作! 二、總體設(shè)計(jì) 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 三、編碼實(shí)現(xiàn) 1)定義圖書結(jié)構(gòu)體 struct book{ char bookname[20]; //書名 int NO; //書編號(hào) char type[20]; //類型 int date; //到書日期 };struct person{ char name[10]; //姓名 char classes[20]; //班級(jí) int number; //學(xué)號(hào) char telephone[12]; //聯(lián)系電話 int NO; //書編號(hào) char bookname[20]; //書名 int borrowdate; //借書日期 int returndate; //還書日期 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 2)登記操作 void new_book(){ FILE *fp;struct book b;//登記新書 int i,j; printf(“請(qǐng)朱老師輸入此次收到的書本總數(shù):”);if((fp=fopen(“shuku.txt”,“a”))==NULL){ printf(“File open error!n”);exit(0);} scanf(“%d”,&i); for(j=0;j printf(“請(qǐng)朱老師輸入書名:”);scanf(“%s”,b.bookname);fprintf(fp,“%s”,b.bookname);printf(“請(qǐng)朱老師輸入書編號(hào):”);scanf(“%d”,&b.NO);fprintf(fp,“ %d”,b.NO);printf(“請(qǐng)朱老師輸入類型:”);scanf(“%s”,b.type); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } } fprintf(fp,“ %s”,b.type);printf(“請(qǐng)朱老師輸入到書日期:”);scanf(“%d”,&b.date);fprintf(fp,“ %d”,b.date);if(fclose(fp)){ } printf(“Can not close the file!n”);exit(0);void new_person() { FILE *fp;struct person p;char choice; //登記借書 if((fp=fopen(“jieshujilu.txt”,“a”))==NULL){ printf(“File open error!n”);exit(0);} 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 printf(“請(qǐng)朱老師輸入借書人姓名:”);scanf(“%s”,p.name);fprintf(fp,“%s”,p.name);printf(“請(qǐng)朱老師輸入借書人班級(jí):”);scanf(“%s”,p.classes);fprintf(fp,“ %s”,p.classes);printf(“請(qǐng)朱老師輸入借書人學(xué)號(hào):”);scanf(“%d”,&p.number);fprintf(fp,“ %d”,p.number);printf(“請(qǐng)朱老師輸入借書人聯(lián)系電話:”);scanf(“%s”,p.telephone);fprintf(fp,“ %s”,p.telephone);printf(“請(qǐng)朱老師輸入書編號(hào):”);scanf(“%d”,&p.NO);fprintf(fp,“ %d”,p.NO);printf(“請(qǐng)朱老師輸入書名:”);scanf(“%s”,p.bookname);fprintf(fp,“ %s”,p.bookname);printf(“請(qǐng)朱老師輸入借書日期:”);scanf(“%d”,&p.borrowdate);fprintf(fp,“ %d”,p.borrowdate); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 printf(“請(qǐng)朱老師輸入還書日期:”);scanf(“%d”,&p.returndate);fprintf(fp,“ %d”,p.returndate);printf(“nt您想繼續(xù)嗎?(y/n)”);scanf(“ %c”,&choice);if(choice=='Y'||choice=='y'){ } system(“cls”);new_person();if(fclose(fp)){ } printf(“Can not close the file!n”);exit(0);}實(shí)現(xiàn)程序?qū)ξ募淖x取 void Read(){ int i=0;int j=0;ifstream in(“Libra.txt”,ios::out);in>>i; 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 nt; } all=i;if(i>0&&i<=Max){ in>>data[j].id>>data[j].name>>data[j].type>>data[j].status>>data[j].coufor(j=1;j<=i;j++){ } } in.close(); 3)查看操作 v void see_book(){ FILE *fp;long NO;char bookname[20];char type[20];long date;//查看書庫記錄 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } if((fp=fopen(“shuku.txt”,“r”))==NULL){ } printf(“File open error!n”);exit(0);while(!feof(fp)){ fscanf(fp,“%s%ld%s%ld”,bookname,&NO,type,&date);printf(“%-10s %-10ld %-10s %ldn”,bookname,NO,type,date);};if(fclose(fp)){ } printf(“Can not close the file!n”);exit(0);void see_person(){ //查看所有借書記錄 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 FILE *fp;char name[10]; char classes[20]; int number;char telephone[20]; int NO; char bookname[20]; int borrowdate; int returndate; fscanf(fp,“%s %s %ld %s %ld %s %ld %ld”,name,classes,&number,telephonwhile(!feof(fp)){ if((fp=fopen(“jieshujilu.txt”,“r”))==NULL){ } printf(“File open error!n”);exit(0);e,&NO,bookname,&borrowdate,&returndate);printf(“%-5s %-5s %ld %-5s %ld %-5s %ld %ldn”,name,classes,number,telephone,NO,bookname,borrowdate,returndate); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } };if(fclose(fp)){ } printf(“Can not close the file!n”);exit(0); 4)刪除操作 void delete_books() { int number;void deletebooks(); printf(“請(qǐng)輸入您要?jiǎng)h除的書編號(hào):”);scanf(“%d”,&number);FILE *fp;struct book b; //刪除舊書 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 if((fp=fopen(“shuku.txt”,“r”))==NULL){ } printf(“不能打開此文件!n”);exit(0);while(!feof(fp)){ fscanf(fp,“%s %d %s %d”,b.bookname,&b.NO,b.type,&b.date); } if(b.NO==number){ } printf(“nnt***************圖書信息*******************n”);printf(“nt圖書書名:%25s”,b.bookname);printf(“nt----------”);printf(“nt圖書編號(hào):%25d”,b.NO);printf(“nt----------”);printf(“nt圖書類型:%23s”,b.type);printf(“nt----------”);printf(“nt到書日期:%25d”,b.date);printf(“nt----------”); deletebooks(); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } void deletebooks(){ while(!feof(fp)){ fscanf(fp,“%s %d %s %d”,b.bookname,&b.NO,b.type,&b.date);if((fp=fopen(“shuku.txt”,“r”))==NULL){ } if((fp1=fopen(“tempshuku.txt”,“w”))==NULL){ //建立一個(gè)臨時(shí)文件 } printf(“不能打開此文件!n”);exit(0);printf(“不能打開此文件!n”);exit(0);printf(“nn確認(rèn)刪除?請(qǐng)?jiān)俅屋斎霑幪?hào):”);scanf(“%d”,&number);FILE *fp,*fp1,*fp2,*fp3;int number;struct book b; 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } if(b.NO==number)continue;else fprintf(fp1,“%s %d %s %d”,b.bookname,b.NO,b.type,b.date);fclose(fp);fclose(fp1);if((fp2=fopen(“tempshuku.txt”,“r”))==NULL){ } if((fp3=fopen(“shuku.txt”,“w”))==NULL){ //清空書庫 } while(!feof(fp2)){ //將臨時(shí)文件的內(nèi)容寫人源文件 } fscanf(fp2,“%s %d %s %d”,b.bookname,&b.NO,b.type,&b.date);fprintf(fp3,“%s %d %s %d”,b.bookname,b.NO,b.type,b.date);printf(“不能打開此文件!n”);exit(0);printf(“不能打開此文件!n”);exit(0); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } void delete_returnbook(){ if((fp=fopen(“jieshujilu.txt”,“r”))==NULL){ } printf(“不能打開此文件!n”);exit(0);printf(“n請(qǐng)輸入所還書本的書編號(hào):”);scanf(“%d”,&numbers);FILE *fp;int numbers;struct person p;void deletereturnbook();char choice;printf(“n 刪除成功!n”);fclose(fp2);fclose(fp3); //刪除借書記錄 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 while(!feof(fp)){ fscanf(fp,“%s %s %ld %s %ld %s %ld %ld”,p.name,p.classes,&p.number,p.telephone,&p.NO,p.bookname,&p.borrowdate,&p.returndate); if(p.NO==numbers){ printf(“nt***************圖書信息*******************n”);printf(“nt借書人姓名:%20s”,p.name);printf(“nt----------”);printf(“nt借書人班級(jí):%20s”,p.classes);printf(“nt----------”);printf(“nt借書人學(xué)號(hào):%20d”,p.number);printf(“nt----------”);printf(“nt借書人聯(lián)系電話:%20s”,p.telephone);printf(“nt----------”);printf(“nt圖書編號(hào):%24d”,p.NO);printf(“nt----------”);printf(“nt圖書名稱:%23s”,p.bookname);printf(“nt----------”);printf(“nt借書日期:%25d”,p.borrowdate);printf(“nt----------”);printf(“nt還書日期:%25d”,p.returndate); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } } } printf(“nt----------”); deletereturnbook(); printf(“nt您想繼續(xù)嗎?(y/n)”);scanf(“ %c”,&choice);if(choice=='Y'||choice=='y'){ } system(“cls”);delete_returnbook();fclose(fp);void deletereturnbook(){ FILE *fp,*fp1,*fp2,*fp3;struct person p; int numbers;printf(“nn確認(rèn)刪除?請(qǐng)?jiān)俅屋斎霑幪?hào):”); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 scanf(“%d”,&numbers);if((fp=fopen(“jieshujilu.txt”,“r”))==NULL){ } if((fp1=fopen(“tempbook.txt”,“w”))==NULL){ } printf(“不能打開此文件!n”);exit(0);printf(“不能打開此文件!n”);exit(0);while(!feof(fp)){ fscanf(fp,“%s %s %d %s %d %s %d %d”,p.name,p.classes,&p.number,p.telephone,&p.NO,p.bookname,&p.borrowdate,&p.returndate); if(p.NO==numbers)continue;else fprintf(fp1,“%s %s %d %s %d %s %d %d”,p.name,p.classes,p.number,p.telephone,p.NO,p.bookname,p.borrowdat 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 e,p.returndate); fscanf(fp2,“%s %s %d %s %d %s %d %d”,p.name,p.classes,while(!feof(fp2)){ //將臨時(shí)文件寫人源文件 if((fp2=fopen(“tempbook.txt”,“r”))==NULL){ } if((fp3=fopen(“jieshujilu.txt”,“w”))==NULL){ } printf(“不能打開此文件!n”);exit(0);printf(“不能打開此文件!n”);exit(0);fclose(fp);fclose(fp1);} &p.number,p.telephone,&p.NO,p.bookname,&p.borrowdate,&p.returndate); fprintf(fp3,“%s %s %d %s %d %s %d %d”,p.name,p.數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 classes,p.number,p.telephone,p.NO,p.bookname,p.borrowdate,p.returndate); } printf(“n 刪除成功!n”);fclose(fp2);fclose(fp3);} 5)Main函數(shù) int main(void){ do{ printf(“nnn 圖書館管理系統(tǒng)na”);printf(“ *******************************************************n”);int choice;char choice2;struct book;struct person; 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 printf(“ ***朱老師您好吖********功能選項(xiàng): 登記******請(qǐng)按1,******n”);printf(“ ******************************* 查看/查詢*請(qǐng)按2 ******n”);printf(“ ******************************* 刪除***** 請(qǐng)按3 ******n”);printf(“ ******************************* 退出***** 請(qǐng)按0 ******n”);printf(“ *******************************************************nnn”);printf(“ 請(qǐng)選擇功能:”);scanf(“%d”,&choice);switch(choice){ case 1: printf(“ 登記選項(xiàng):新書登記請(qǐng)按1,借書登記請(qǐng)按2,返回請(qǐng)按3n”);printf(“請(qǐng)選擇:”);scanf(“%d”,&choice);switch(choice){ case 1: system(“cls”); //清屏 printf(“新書資料登記:nn”);new_book(); //新書登記 printf(“登記完畢!n”);printf(“n”);scanf(“ %c”,&choice2);system(“cls”);break; 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 case 2: system(“cls”);printf(“借書資料登記:nn”);new_person(); //借書登記 printf(“n press anykey ”);scanf(“ %c”,&choice2);system(“cls”);break;case 3: } break;system(“cls”);break; case 2: printf(“ 查看/查詢選項(xiàng):書庫查看請(qǐng)按1,總借書記錄查看請(qǐng)按2,到期記錄查詢請(qǐng)按3,返回請(qǐng)按4n”); printf(“請(qǐng)選擇:”);scanf(“%d”,&choice);switch(choice){ case 1: system(“cls”);printf(“歡迎朱老師進(jìn)入書庫!nn”); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 printf(“書名 書編號(hào) 類型 到書日期n”);printf(“-----------n”);see_book(); //書庫顯示 printf(“n press anykey ”);scanf(“ %c”,&choice2);system(“cls”);break;case 2: system(“cls”);printf(“歡迎朱老師進(jìn)入借書記錄!nn”);printf(“姓名 班級(jí) 學(xué)號(hào) 聯(lián)系電話 書編號(hào) 書名 借書日期 到書日期n”); printf(“-------------------------n”);see_person(); //借書記錄顯示 printf(“n press anykey ”);scanf(“ %c”,&choice2);system(“cls”);break;case 3: system(“cls”);search_person(); //顯示符合記錄 printf(“n press anykey ”); 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 scanf(“ %c”,&choice2);system(“cls”);break;case 4: } break;system(“cls”);break;case 3: printf(“ 刪除選項(xiàng):舊書刪除請(qǐng)按1,借書記錄刪除請(qǐng)按2,返回請(qǐng)按3n”); printf(“請(qǐng)選擇:”);scanf(“%d”,&choice);switch(choice){ case 1: system(“cls”);delete_books(); //刪除ing printf(“n press anykey ”);scanf(“ %c”,&choice2);system(“cls”);break;case 2: 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 } system(“cls”);delete_returnbook(); //刪除ing printf(“n press anykey ”);scanf(“ %c”,&choice2);system(“cls”);break;case 3: } break;system(“cls”);break;case 0: } system(“cls”);}while(choice!= 0);return 0; 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 四、調(diào)試與測試 主菜單 登記 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊 查看 刪除 生成的文件內(nèi)信息 數(shù)據(jù)結(jié)構(gòu)大作業(yè) 121279044 伍楊五、五心得體會(huì) 經(jīng)過這次大作業(yè),我覺得代碼的編寫,最主要的的是編程思想,語言其實(shí)不是太重要,思路最重要! 六、用戶手冊(cè) 程序執(zhí)行文件為 lib sys.exe,打開執(zhí)行文件后按提示操作即可 教職工信息管理系統(tǒng)源碼 #include #define maxsize 100 fstream iofile;//文件指針 class Time //時(shí)間類 { public: int year; int month; int day;}; class Telem //個(gè)人信息 { public: char name[20]; char sex[10]; Time birthtime;//組合Time類 char num[20]; char wage[20]; Time worktime; int year; char department[20]; friend istream& operator>>(istream& input,Telem& T); friend ostream& operator<<(ostream& output,Telem& T); friend int operator-(Time & t1,Time & t2);}; class People:virtual public Telem //雇員類 { public: People(); virtual void AddF()=0;//添加 virtual void Addall()=0; virtual void Add()=0; virtual void Display();//輸出數(shù)組的內(nèi)容 virtual void Displaypart(char p[]); virtual void Findname(char n[]); virtual void Findyear(int); virtual void Del(char n[])=0; virtual void Del(int);protected: Telem data[maxsize]; Time now; int length;}; class Teacher:virtual public People //派生虛基類 { public: virtual void AddF(); virtual void Addall(); virtual void Add(); virtual void Display(); virtual void Del(int i); virtual void Del(char n[]);}; class worker:virtual public People //派生虛基類 { public: virtual void AddF(); virtual void Addall(); virtual void Add(); virtual void Display(); virtual void Del(int i); virtual void Del(char n[]);}; People::People()//系統(tǒng)自動(dòng)生成的構(gòu)造函數(shù) { length=0; now.year=2010; now.month=7; now.day=6;} void People::Display()//引用 { int i; for(i=0;i cout< void People::Displaypart(char p[])//引用數(shù)組 { int i,c; for(i=0;i if(strcmp(data[i].wage,p)==0) { cout<<“輸出選擇姓名1 性別2 編號(hào)3 工資4 出生日期5 工作時(shí)間6 年齡7 系別8 退出選擇9”< while(cin>>c) { switch(c) { case 1: cout<<“姓名:”< case 2: cout<<“性別:”< case 3: cout<<“編號(hào):”< case 4: cout<<“工資:”< case 5: cout<<“出生日期:”< case 6: cout<<“工作時(shí)間:”< case 7: cout<<“年齡:”< case 8: cout<<“系別:”< case 9: goto loop; default:cout<<“操作錯(cuò)誤......”< } } loop:; } } void People::Findname(char n[])//引用 { int i; for(i=0;i if(strcmp(data[i].name,n)==0)//對(duì)象引用 cout< void People::Findyear(int y){ int i; for(i=0;i if(data[i].year==y) cout< void People::Del(int i){ int j; if(i<1||i>length) cout<<“不存在第”< for(j=i;j data[j-1]=data[j]; length--;} void worker::AddF(){ int flag=0; iofile.open(“worker_information.txt”,ios::in|ios::binary);//文件的打開與關(guān)閉 while(iofile.seekg(ios::cur)) { iofile.seekg(length*sizeof(data[length]),ios::beg); iofile.read((char*)&data[length],sizeof(data[length]));//文件的隨機(jī)訪問 length++; if(length==maxsize) { flag=1; goto loop; } } People::Del(length); cout<<“添加人員信息成功......”< loop: if(1==flag) cout<<“人員信息儲(chǔ)存空間已滿......”< iofile.close();} void worker::Addall(){ char ans; int flag=0; iofile.open(“worker_information.txt”,ios::out|ios::binary); do { cin>>data[length]; data[length].year=now-data[length].birthtime; iofile.write((char*)&data[length],sizeof(data[length])); cout<<“添加人員信息成功......”< length++; if(length==maxsize) { flag=1; goto loop; } cout<<“contine(Y|N)?”; cin>>ans; }while('y'==ans||'Y'==ans);loop: if(1==flag) cout<<“人員信息儲(chǔ)存空間已滿......”< iofile.close();} void worker::Add(){ int flag=0; iofile.open(“worker_information.txt”,ios::app|ios::out|ios::binary); if(length==maxsize) { flag=1; goto loop; } cin>>data[length]; data[length].year=now-data[length].birthtime; iofile.write((char*)&data[length],sizeof(data[length])); cout<<“添加人員信息成功......”< length++; loop: if(1==flag) cout<<“人員信息儲(chǔ)存空間已滿......”< iofile.close();} void worker::Display(){ cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆工人信息 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”< if(0==length) cout<<“無......”< int i; for(i=0;i cout< int i,j,k; for(i=0;i if(strcmp(data[i].name,n)==0){ k=i+1;break;} if(k<1) cout<<“不存在姓名”< for(j=k;j data[j-1]=data[j]; length--; cout<<“刪除人員信息成功......”< void worker::Del(int i){ int j; if(i<1||i>length) cout<<“不存在第”< for(j=i;j data[j-1]=data[j]; length--; cout<<“刪除成功......”< } void Teacher::AddF(){ int flag=0; iofile.open(“Teacher_information.txt”,ios::in|ios::binary); while(iofile.seekg(sizeof(data[length]),ios::cur)) { if(iofile.seekg(length*sizeof(data[length]),ios::beg)) iofile.read((char*)&data[length],sizeof(data[length])); else break; length++; if(length==maxsize) { flag=1; goto loop; } } People::Del(length); cout<<“添加人員信息成功......”< if(1==flag) cout<<“人員信息儲(chǔ)存空間已滿......”< iofile.close();} void Teacher::Addall(){ char ans; int flag=0; iofile.open(“Teacher_information.txt”,ios::in|ios::out|ios::binary); do { cin>>data[length]; data[length].year=now-data[length].birthtime; iofile.write((char*)&data[length],sizeof(data[length])); cout<<“添加人員信息成功......”< length++; if(length==maxsize) { flag=1; goto loop; } cout<<“contine(Y|N)?”; cin>>ans; }while('y'==ans||'Y'==ans);loop: if(1==flag) cout<<“人員信息儲(chǔ)存空間已滿......”< iofile.close();} void Teacher::Add(){ int flag=0; iofile.open(“Teacher_information.txt”,ios::app|ios::out|ios::binary); if(length==maxsize) { flag=1; goto loop; } cin>>data[length]; data[length].year=now-data[length].birthtime; iofile.write((char*)&data[length],sizeof(data[length])); cout<<“添加人員信息成功......”< length++;loop: if(1==flag) cout<<“人員信息儲(chǔ)存空間已滿......”< iofile.close();} void Teacher::Display(){ cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆教師信息 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”< if(0==length) cout<<“無......”< int i; for(i=0;i cout< void Teacher::Del(char n[]){ int i,j,k; for(i=0;i if(strcmp(data[i].name,n)==0) { k=i+1;break; } if(k<1)cout<<“不存在姓名”< for(j=k;j data[j-1]=data[j]; length--; cout<<“刪除人員信息成功......”< void Teacher::Del(int i){ int j; if(i<1||i>length) cout<<“不存在第”< for(j=i;j data[j-1]=data[j]; length--; cout<<“刪除成功......”< istream& operator>>(istream& input,Telem& T){ int y,m,d; cout<<“請(qǐng)輸入姓名(以*結(jié)尾):”< input.getline(T.name,20,'*'); cout<<“請(qǐng)輸入性別(以*結(jié)尾 男或女):”< input.getline(T.sex,10,'*'); cout<<“編號(hào)(以*結(jié)尾):”< input.getline(T.num,20,'*'); cout<<“工資(以*結(jié)尾):”< input.getline(T.wage,20,'*'); cout<<“請(qǐng)輸入出生日期:”< input>>y>>m>>d; T.birthtime.year=(y>=1900&&y<=2100)?y:1900; T.birthtime.month=(m>=1&&m<=12)?m:1; T.birthtime.day=(d>=1&&d<=31)?d:1; cout<<“請(qǐng)輸入系別(以*結(jié)尾):”< input.getline(T.department,20,'*'); cout<<“參加工作時(shí)間:”< input>>y>>m>>d; T.worktime.year=(y>=1900&&y<=2100)?y:1900; T.worktime.month=(m>=1&&m<=12)?m:1; T.worktime.day=(d>=1&&d<=31)?d:1; return input;} ostream& operator<<(ostream& output,Telem& T){ cout<<“姓名:”; output< cout<<“性別:”; output< cout<<“編號(hào):”; output< cout<<“工資:”; output< cout<<“出生日期:”; output< cout<<“系別:”; output< cout<<“參加工作時(shí)間:”; output< cout<<“年齡:”; output< return output;} int operator-(Time & t1,Time & t2){ return t1.year-t2.year;} void Showmenu(){ cout< cout<<“ 歡 迎 進(jìn) 入 教 職 工 信 息 管 理 系 統(tǒng)”< cout<<“ 2010 年7月7日發(fā)布”<<“ 版權(quán)所有: swa”< cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★人員信息管理系統(tǒng)★ ☆ ★ ☆ ★ ☆ ★ ☆ ★”< cout<<“ ★ 1-從鍵盤錄入全部人員記錄 ☆ ”< cout<<“ ☆ 2-增加一位人員記錄 ★”< cout<<“ ★ 3-顯示全部人員記錄 ☆”< cout<<“ ☆ 4-按系別輸出人員信息(可選)★ ”< cout<<“ ★ 5-按姓名或年齡檢索所有信息☆ ”< cout<<“ ☆ 6-顯示菜單目錄 ★ ”< cout<<“ ★ 7-結(jié)束程序運(yùn)行 ☆ ”< cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”< int main(){ Teacher tea; worker stu; People *pt=&tea; People *ps=&stu; int c=0,k=0,l=0,i=0; char nam[20],part[20];Showmenu(); for(;;) { cout<<“請(qǐng)根據(jù)菜單執(zhí)行相應(yīng)操作: ”; cin>>c; switch(c) { case 1: { cout<<“ ★ ☆ ★ ☆ ★ ☆ ★錄入全部人員記錄 ★ ☆ ★ ☆ ★ ☆ ★”< cout<<“ ★ ☆ ★ ☆ ★從鍵盤輸入教師信息 ☆ ★ ☆ ★ ☆”< pt->Addall(); cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆從鍵盤輸入工人信息 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”< ps->Addall(); break; } case 2: { cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆從鍵盤增加一位人員記錄 ★ ☆ ★ ☆ ★ ☆ ★ ☆”< cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆教師操作請(qǐng)按1 工人操作請(qǐng)按2 ★ ☆ ★ ☆ ★ ☆ ★ ☆”< cin>>k; if(1==k) pt->Add(); else if(2==k) ps->Add(); else cout<<“操作錯(cuò)誤...”< break; } case 3: { cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆顯示全部人員記錄 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”< pt->Display(); ps->Display(); break; } case 4: { cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆按部門輸出人員信息(可選)★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”< cout<<“ ★ ☆ ★ ☆ ★ ☆教師操作請(qǐng)按1 工人操作請(qǐng)按2 ★ ☆ ★ ☆ ★ ☆”< cin>>k; if(1==k) { cout<<“請(qǐng)輸入要輸出人員的系別(以*結(jié)尾):”< pt->Displaypart(part); } else if(2==k) { cout<<“請(qǐng)輸入要輸出人員的系別(以*結(jié)尾):”< ps->Displaypart(part); } else cout<<“操作錯(cuò)誤......”< break; } case 5: { cout<<“ ★ ☆ ★ ☆ ★ ☆ ★按姓名或年齡檢索所有信息 ★ ☆ ★ ☆ ★ ☆ ★”< cout<<“ ★ ☆ ★ ☆ ★ ☆ ★按姓名查找1 按年齡查找2 ★ ☆ ★ ☆ ★ ☆ ★”< cin>>k; if(1==k) { cout<<“按姓名查找1 按年齡查找2”< if(1==l) { cout<<“請(qǐng)輸入要查找人員的姓名(以*結(jié)尾):”< pt->Findname(nam); } else if(2==l) { cout<<“請(qǐng)輸入要查找人的年齡:”< pt->Findyear(i); } else cout<<“操作錯(cuò)誤......”< } else if(2==k) { cout<<“按姓名查找1 按年齡查找2”< if(1==l) { cout<<“請(qǐng)輸入要查找人員的姓名(以*結(jié)尾):”< ps->Findname(nam); } else if(2==l) { cout<<“請(qǐng)輸入要查找人的年齡:”< ps->Findyear(i); } else cout<<“操作錯(cuò)誤......”< } else cout<<“操作錯(cuò)誤......”< break; } case 6: { cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆顯示菜單目錄 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”< Showmenu(); break; } case 7: { cout<<“ ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆結(jié)束程序運(yùn)行 ★ ☆ ★ ☆ ★ ☆ ★ ☆ ★ ☆”< exit(0); } default:cout<<“操作錯(cuò)誤......”< } } return 0;}第二篇:C語言課程設(shè)計(jì)——飛機(jī)訂票系統(tǒng)源代碼
第三篇:c語言課程設(shè)計(jì)-學(xué)籍管理系統(tǒng)(含源代碼)
第四篇:圖書管理系統(tǒng)(含源代碼)c語言_數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì)報(bào)告
第五篇:C++課程設(shè)計(jì) 教職工信息管理系統(tǒng)源代碼