




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、課 程 設(shè) 計服務(wù)課程名稱: c語言 系: 專業(yè): 班級: 學(xué)號: 姓名: 指導(dǎo)教師: 課程設(shè)計周次: 起始日期:2008.6.16至2008.6.20 目錄1. c語言課程設(shè)計成績評定表.02頁2. c語言課程設(shè)計任務(wù)書.03頁3. 程序基本框架結(jié)構(gòu)圖.04頁4. 程序設(shè)計說明書.05頁5. 源代碼清單.06頁6. 課程設(shè)計總結(jié).18頁課程設(shè)計成績評定表班級學(xué)號姓名項目組第3組項目組長項目組組員本人工作簡介:此次編程我的主要工作是排序部分的編譯。組長評語:在這次的c語言課程設(shè)計中,做了程序的“排序”部分的編寫。不但程序編寫的沒有錯誤,而且在小組的討論中積極發(fā)表觀點,起到了舉足輕重的作用。成績
2、評定標(biāo)準(zhǔn)abcde報告完成情況很好好比較好一般不好紀(jì)律表現(xiàn)很好好比較好一般不好程序功能性強(qiáng)較強(qiáng)一般較弱弱界面美觀性很好好一般較差不好程序可操作性很好好一般較差不好答辯表現(xiàn)很好好一般較差不好所起作用程度80%以上60%以上60%以下最后成績優(yōu)秀a=5c=3c=2c=4及格a=0b=0c=3不及格a=0b=0c=1負(fù)責(zé)指導(dǎo)教師: (簽名)指導(dǎo)教師: (簽名) 班c語言課程設(shè)計任務(wù)書一、設(shè)計目的通過本次課程設(shè)計使學(xué)生進(jìn)一步加深對c語言課程內(nèi)容的理解,初步掌握一般應(yīng)用程序的開發(fā)方法和步驟,進(jìn)一步了解與掌握c語言的編程方法和技巧,提高學(xué)生用c語言解決實際問題的能力。二、設(shè)計要求1、認(rèn)真查閱參考書、資料2
3、、遵守課程設(shè)計時間安排3、按時上機(jī),認(rèn)真調(diào)試程序4、認(rèn)真完成課程設(shè)計報告三、課設(shè)報告裝訂內(nèi)容及順序1、課程設(shè)計封皮2、目錄3、課程設(shè)計成績評定表4、課程設(shè)計任務(wù)書5、程序基本框架圖 6、程序設(shè)計說明書7、源代碼清單8、課設(shè)總結(jié)與心得四、設(shè)計題目學(xué)生檔案管理賓館住宿管理學(xué)生宿舍管理學(xué)生成績管理學(xué)生選修課程系統(tǒng)工資管理五、時間安排(一周:從06月16日到 06月20日 )1、查閱資料及程序設(shè)計(1天)2、程序編制及調(diào)試(3天)3、成績評定(0.5天)3、打印報告(0.5天)六、參考文獻(xiàn)1、c語言程序設(shè)計李淑華/李貞編 大連理工大學(xué)出版社2、c語言程序設(shè)計孫連科/姚大鵬編 遼海出版社3、c+時尚編程
4、百例網(wǎng)冠科技編.機(jī)械工業(yè)出版社4、turbo c 實用大全徐金梧等編. 機(jī)械工業(yè)出版社程序基本框架結(jié)構(gòu)圖學(xué)生宿舍管理系統(tǒng)數(shù)據(jù)輸入退出系統(tǒng)數(shù)據(jù)追加數(shù)據(jù)查詢數(shù)據(jù)排序數(shù)據(jù)顯示按專業(yè)排序返回按學(xué)號查詢按姓名查詢按專業(yè)查詢返回按學(xué)號排序按姓名排序程序設(shè)計說明書首先,組員討論分工,確定我所負(fù)責(zé)的部分是排序函數(shù)。我們初步確定數(shù)據(jù)結(jié)構(gòu)全為字符型,分:學(xué)號,姓名,性別,專業(yè),寢室共5個數(shù)據(jù)項。確定需要編譯的系統(tǒng)功能為:輸入,追加,顯示,查詢,排序五項功能。排序:從文件中讀取文件中的數(shù)據(jù)并記錄數(shù)據(jù)個數(shù)。用for循環(huán)將數(shù)據(jù)單挑比較,strcmp(aj.qsh,aj-1.qsh)0當(dāng)此值為真aj.qsh的長度小于aj
5、-1.qsh兩者交換,實現(xiàn)數(shù)據(jù)升序排列,屬冒泡排序。for(i=0;in;i+) printf(tt%st%st%st%st%sn,ai.xho,,ai.sex,ai.aclass,ai.qsh);再輸出顯示在屏幕上,供用戶使用。源代碼清單#includestdio.h#includestdlib.h#includestring.h#includectype.htypedef struct student /寢室學(xué)生記錄結(jié)構(gòu) char xho20; /學(xué)號 char name20; /姓名char sex5; /性別 char aclass20; /專業(yè) char qsh10;
6、/寢室 stu; void menu(); /菜單選擇函數(shù) void input(); /輸入函數(shù) void list(); /顯示函數(shù) void append(); /追加記錄函數(shù) void search(); void sort(); void searchxho(); /按照學(xué)號查找的函數(shù) void searchname(); /按照姓名查找的函數(shù) void searchaclass(); /按照專業(yè)查找的函數(shù) void sortxho(); /按照學(xué)號排序的函數(shù) void sortaclass(); /按照專業(yè)排序的函數(shù) void sortqsh(); /按照寢室排序的函數(shù) void
7、wronglist1(); void wronglist2(); void wronglist3();main() menu(); void menu() int a; do system(cls); printf(tt 歡迎使用學(xué)生宿舍管理系統(tǒng)n); printf(tt*n); printf(tt* 編制人員:汪* 李* 遲* 趙* *n); printf(tt* 版本號:072-3 *n); printf(tt*n); printf(nnnnttt學(xué)生宿舍管理系統(tǒng)n); printf(tt*n);printf(tt* 1-輸入 *n);printf(tt* 2-顯示 *n);printf(
8、tt* 3-追加 *n);printf(tt* 4-查詢 *n);printf(tt* 5-排序 *n);printf(tt* 0-退出系統(tǒng) *n); printf(tt*n);printf(tt請選擇:); scanf(%d,&a);switch(a)case 1:input(); break; case 2:list(); break; case 3:append(); break; case 4:search(); break; case 5:sort(); break; case 0:printf(tt*謝謝使用*n);exit(0); default:printf(ttt輸入錯誤請重
9、新輸入:); while(a!=0);void input()int i,n; stu a; file *fp; system(cls); if(fp=fopen(e:file1,wb)=null) printf(error!n);exit(0); printf(nt請輸入學(xué)生人數(shù):); scanf(%d,&n); for(i=0;in;i+) printf(nnt學(xué)號:); scanf(%s,a.xho); printf(t姓名:); scanf(%s,); printf(t性別:); scanf(%s,a.sex); printf(t專業(yè):); scanf(%s,a.aclas
10、s); printf(t寢室號:); scanf(%s,a.qsh); fwrite(&a,sizeof(stu),1,fp); printf(nnt*輸入完畢*n); fclose(fp); printf(nnnnnt*請按鍵返回*n); doscanf(%d,&i); switch(i) case 0:menu();break; default:printf(ttt輸入錯誤請重新輸入:); while(i!=0);void list() stu a; int i; file *fp; system(cls); if(fp=fopen(e:file1,rb)=null) printf(err
11、or!n);exit(0); printf(nnnt*n); printf(tt學(xué)號tt姓名t性別t專業(yè)t寢室nn); while(fread(&a,sizeof(stu),1,fp)!=0) printf(tt%stt%st%st%st%sn,a.xho,,a.sex,a.aclass,a.qsh); fclose(fp); printf(nnnt*請按鍵返回*n); doscanf(%d,&i); switch(i) case 0:menu();break; default:printf(ttt輸入錯誤請重新輸入:); while(i!=0);void append()stu
12、t; int i,n,m; file *fp; system(cls); if(fp=fopen(e:file1,ab)=null) printf(error!n);exit(0); printf(ttt追加學(xué)生人數(shù):); scanf(%d,&n); for(i=0;in;i+) printf(nnt學(xué)號:); scanf(%s,t.xho); printf(t姓名:); scanf(%s,); printf(t性別:); scanf(%s,t.sex); printf(t專業(yè):); scanf(%s,t.aclass); printf(t寢室號:); scanf(%s,t.qsh
13、); fwrite(&t,sizeof(stu),1,fp); fclose(fp); printf(nnnt*請按鍵返回*n); doscanf(%d,&m); switch(m) case 0:menu();break; default:printf(ttt輸入錯誤請重新輸入:); while(m!=0);void search()int a; dosystem(cls); printf(nnnnttt學(xué)生宿舍管理查詢系統(tǒng)n); printf(tt*n); printf(tt* 1-按學(xué)號查詢 *n); printf(tt* 2-按姓名查詢 *n); printf(tt* 3-按專業(yè)查詢
14、*n); printf(tt* 0-返回 *n); printf(tt*n); printf(tt請選擇:); scanf(%d,&a); switch(a)case 1:searchxho(); break; case 2:searchname(); break; case 3:searchaclass(); break; case 0:menu(); default:printf(ttt輸入錯誤請重新輸入:);while(a!=0);void sort()int a;do system(cls);printf(nnnnttt學(xué)生宿舍管理排序系統(tǒng)n); printf(tt*n);printf
15、(tt* 1-按學(xué)號排序 *n);printf(tt* 2-按專業(yè)排序 *n);printf(tt* 3-按寢室排序 *n);printf(tt* 0-返回 *n); printf(tt*n);printf(tt請選擇:);scanf(%d,&a);switch(a)case 1:sortxho(); break; case 2:sortaclass(); break; case 3:sortqsh(); break; case 0:menu(); default:printf(ttt輸入錯誤請重新輸入:); while(a!=0);void sortxho()int i,j,m,n=0; s
16、tu a10,t; file *fp; system(cls); if(fp=fopen(e:file1,rb)=null) printf(error!n);exit(0); while(fread(&an,sizeof(stu),1,fp)!=0) n+; for(i=0;ii;j-) if(strcmp(aj.xho,aj-1.xho)0) t=aj;aj=aj-1;aj-1=t; printf(nnt*按學(xué)號排序*n); printf(tt學(xué)號t姓名t性別t專業(yè)t寢室nn); for(i=0;in;i+) printf(tt%st%st%st%st%sn,ai.xho,,a
17、i.sex,ai.aclass,ai.qsh); fclose(fp); printf(nnnt*請按鍵返回*n); doscanf(%d,&m); switch(m) case 0:sort();break; default:printf(ttt輸入錯誤請重新輸入:); while(m!=0);void sortaclass()int i,j,n=0,m; stu a10,t; file *fp; system(cls); if(fp=fopen(e:file1,rb)=null) printf(error!n);exit(0); while(fread(&an,sizeof(stu),1,
18、fp)!=0) n+; for(i=0;ii;j-) if(strcmp(aj.aclass,aj-1.aclass)0) t=aj;aj=aj-1;aj-1=t; printf(nnt*按專業(yè)排序*n); printf(tt學(xué)號t姓名t性別t專業(yè)t寢室nn); for(i=0;in;i+) printf(tt%st%st%st%st%sn,ai.xho,,ai.sex,ai.aclass,ai.qsh); fclose(fp); printf(nnnt*請按鍵返回*n); doscanf(%d,&m); switch(m) case 0:sort();break; defaul
19、t:printf(ttt輸入錯誤請重新輸入:); while(m!=0);void sortqsh()int i,j,n=0,m; stu a10,t; file *fp; system(cls); if(fp=fopen(e:file1,rb)=null) printf(error!n);exit(0); while(fread(&an,sizeof(stu),1,fp)!=0) n+; for(i=0;ii;j-) if(strcmp(aj.qsh,aj-1.qsh)0) t=aj;aj=aj-1;aj-1=t; printf(nnt*按寢室排序*n); printf(tt學(xué)號t姓名t性別
20、t專業(yè)t寢室nn); for(i=0;in;i+) printf(tt%st%st%st%st%sn,ai.xho,,ai.sex,ai.aclass,ai.qsh); fclose(fp); printf(nnnt*請按鍵返回*n); doscanf(%d,&m); switch(m) case 0:sort();break; default:printf(ttt輸入錯誤請重新輸入:); while(m!=0);void searchname()int i,n=0,m; char name20; stu a20; file *fp; system(cls); printf(nn
21、tt請輸入要查找的姓名:); scanf(%s,name); if(fp=fopen(e:file1,rb)=null) printf(error!n);exit(0); while(fread(&an,sizeof(stu),1,fp)!=0) n+; for(i=0;in;i+) if(strcmp(,name)=0) printf(nnt*查詢信息*n); printf(tt學(xué)號t姓名t性別t專業(yè)t寢室nn); printf(ntt%st%st%st%st%sn,ai.xho,,ai.sex,ai.aclass,ai.qsh); else wronglist1
22、(); fclose(fp); printf(nnnt*請按鍵返回*n); doscanf(%d,&m); switch(m) case 0:sort();break; default:printf(ttt輸入錯誤請重新輸入:); while(m!=0);void wronglist1()int a; printf(nntt沒有要查找的信息,請確認(rèn)后重新查詢); printf(ntt是否重新查找(否0/是1):); scanf(%d,&a); switch(a)case 0: search(); break; case 1: searchname(); break; default: prin
23、tf(輸入錯誤!系統(tǒng)將自動返回); search();void searchxho()int i,n=0,m; char xho20; stu a20; file *fp; system(cls); printf(nntt請輸入要查找的學(xué)號:); scanf(%s,xho); if(fp=fopen(e:file1,rb)=null) printf(error!n);exit(0); while(fread(&an,sizeof(stu),1,fp)!=0) n+; for(i=0;in;i+) if(strcmp(ai.xho,xho)=0) printf(nnt*查詢信息*n); prin
24、tf(tt學(xué)號t姓名t性別t專業(yè)t寢室nn); printf(ntt%st%st%st%st%sn,ai.xho,,ai.sex,ai.aclass,ai.qsh); else wronglist2(); fclose(fp); printf(nnnt*請按鍵返回*n); doscanf(%d,&m); switch(m) case 0:sort();break; default:printf(ttt輸入錯誤請重新輸入:); while(m!=0);void wronglist2()int a; printf(nntt沒有要查找的信息,請確認(rèn)后重新查詢); printf(ntt是
25、否重新查找(否0/是1):); scanf(%d,&a); switch(a)case 0: search(); break; case 1: searchxho(); break; default: printf(輸入錯誤!系統(tǒng)將自動返回); search();void searchaclass()int i,n=0,m; char aclass20; stu a20; file *fp; system(cls); printf(nntt請輸入要查找的專業(yè):); scanf(%s,aclass); if(fp=fopen(e:file1,rb)=null) printf(error!n);e
26、xit(0); while(fread(&an,sizeof(stu),1,fp)!=0) n+; for(i=0;in;i+) if(strcmp(ai.aclass,aclass)=0) printf(nnt*查詢信息*n); printf(ntt學(xué)號t姓名t性別t專業(yè)t寢室nn); printf(ntt%st%st%st%st%sn,ai.xho,,ai.sex,ai.aclass,ai.qsh); else wronglist2(); fclose(fp); printf(nnntt*請按鍵返回*n); doscanf(%d,&m); switch(m) case 0:sort();break; default:printf(ttt輸入錯誤請重新輸入:); while(m!=0);v
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 醫(yī)院招聘護(hù)士合同范例
- 公共器材租賃合同范本
- 合同范本 合作
- 公司勞動用工合同范本簡版
- 售后回租合同范本
- 出租野餐工具合同范本
- 合同范本些可以修改
- 化妝造型合同范本
- 華能電廠合同范本
- 員工內(nèi)部合同范本
- JTJ034-2000 公路路面基層施工技術(shù)規(guī)范
- 2024全國各地區(qū)英語中考真題匯編《第一期》
- 電梯應(yīng)急救援與事故處理考核試卷
- 第1章 跨境電商概述
- 2024-2030年中國長管拖車行業(yè)市場發(fā)展趨勢與前景展望戰(zhàn)略分析報告
- 《高等教育學(xué)》近年考試真題題庫(含答案)
- 2024福建省廈門市總工會擬錄用人員筆試歷年典型考題及考點剖析附答案帶詳解
- 2024風(fēng)力發(fā)電機(jī)組預(yù)應(yīng)力基礎(chǔ)錨栓籠組合件技術(shù)規(guī)范
- 供熱管道施工組織設(shè)計
- 浙江省中小學(xué)心理健康教育教師上崗資格證書管理辦法(修訂)
- 2024年2月時政熱點總結(jié)
評論
0/150
提交評論