![C語言課程設計__歌曲信息管理系統(tǒng)_第1頁](http://file4.renrendoc.com/view/8a38ee9c7ea5d3606dba45c2b6d14975/8a38ee9c7ea5d3606dba45c2b6d149751.gif)
![C語言課程設計__歌曲信息管理系統(tǒng)_第2頁](http://file4.renrendoc.com/view/8a38ee9c7ea5d3606dba45c2b6d14975/8a38ee9c7ea5d3606dba45c2b6d149752.gif)
![C語言課程設計__歌曲信息管理系統(tǒng)_第3頁](http://file4.renrendoc.com/view/8a38ee9c7ea5d3606dba45c2b6d14975/8a38ee9c7ea5d3606dba45c2b6d149753.gif)
![C語言課程設計__歌曲信息管理系統(tǒng)_第4頁](http://file4.renrendoc.com/view/8a38ee9c7ea5d3606dba45c2b6d14975/8a38ee9c7ea5d3606dba45c2b6d149754.gif)
![C語言課程設計__歌曲信息管理系統(tǒng)_第5頁](http://file4.renrendoc.com/view/8a38ee9c7ea5d3606dba45c2b6d14975/8a38ee9c7ea5d3606dba45c2b6d149755.gif)
版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領
文檔簡介
1、C語言課程設計實習報告專 業(yè):學 號:班級序號:姓 名:指導教師:C語言程序設計報告(實習日期:2010-8至2010-9)一、C語言課程設計的目的:高級語言課程設計是學習完高級語言程序設計課程后進行的一次全面的 綜合性上機實驗。其目的在于為同學提供了一個既動手又動腦,獨立實踐的機會, 將課本上的理論知識和實際有機的結(jié)合起來,鍛煉同學的分析解決實際問題的能 力。提高學生適應實際,實踐編程的能力。二、題目:歌曲信息管理系統(tǒng)需求分析:制作一個歌曲信息管理系統(tǒng)使之有以下功能1歌曲信息包括歌曲名,作者,演唱者,發(fā)行年月等。2可以對歌曲信息進行輸入,刪除,瀏覽。3可以查詢歌曲名,作者,演唱者信息。4可以
2、提供按作者顯示功能。5用文件存儲信息。三、總體設計根據(jù)分析,整個系統(tǒng)可設計為以下4個模塊:信息輸入模塊,刪除模塊,瀏覽模塊。查找模塊。歌曲管理系統(tǒng)I)信息輸入:依次按順序結(jié)構(gòu)輸入歌曲名,作者,演唱者,發(fā)行年月。(圖2)信息刪除:根據(jù)輸入的歌曲名,作者,演唱者等一項可以刪除對應的其他項刪除模塊(delete)輸入歌曲名(enter name)I)輸入作者(enter author),)輸入演唱者(enter singer)(圖3)信息瀏覽:可以直接瀏覽歌曲,作者,演唱者,發(fā)行年月。轍曲瀏覽V)例覽作者瀏覽歌曲名瀏覽演唱者 f瀏覽日期(圖4)信息查找:可以查找歌曲,作者等。并且可以選擇查找的方式:
3、按作曲者、 按演唱者、按歌曲名字。(圖5)退出模塊點擊直接退出四詳細設計1結(jié)構(gòu)體#include #include #include #include int i=0;struct system(char author20;char singer20;char time20;char name20; dan100;2主函數(shù)主函數(shù)的設計提供數(shù)據(jù)輸入、數(shù)據(jù)處理和數(shù)據(jù)輸出以及各種函數(shù)的調(diào)用。 其中各功能模塊用菜單方式選擇;另外,部分菜單也可以寫成函數(shù)。void main()(void menu();void function1();void function2();void function3();
4、void function4();menu();return;題目對應具體的程序如下: main() (int a;while(1)(printf(ttWelcome to the songsystem!bylongn); printf(tt*AoAMENUAoA*nn);printf(ttt(1).Entern);printf(ttt(2).Deleten);printf(ttt(3).Browsen);printf(ttt(4).Searchn);printf(ttt(0).exitn);switch(a)(case 1:enter();break;case 2:delete();brea
5、k;case 3:browse();break;case 4:search();break;主函數(shù)的流程圖如圖63各功能模塊設計(1)輸入模塊void enter()(int j;char c2;FILE *fp;if(fp=fopen(data.txt,w)=NULL)(printf(Can not open the file!n);exit(0);for(j=0;ji;j+)(fwrite(&danj,sizeof(struct system),1,fp);while(1)(printf(Please input the author:n);scanf(%s,dani.author);pr
6、intf(Please input the songs name:n);scanf(%s,); printf(Please input the singer:n);scanf(%s,dani.singer);printf(Please input the outday:n);scanf(%s,dani.time);if(fwrite(&dani+,sizeof(struct system),1,fp)!=1) printf(File write errorn);else printf(Successful!n);printf(Is there any more?( Yesy/
7、Non) n);scanf(%s,c);if(strcmp(c,n)=0)break;fclose(fp);輸入作者輸入歌曲名字輸入演唱者輸入發(fā)行日期是否繼續(xù)輸入?(圖7)(圖2)2刪除模塊:用戶輸入要刪除的信息,如輸入歌曲名,根據(jù)歌曲名找到其他記錄并刪除。程序void delete()(int j,v,c;char w20;FILE *fp;printf(Please input the songname which you want to delete:);scanf(%s,w);fp=fopen(data.txt”,rb”);for(j=0;j100;j+)(if(fread(&danj
8、,sizeof(struct system),1,fp)!=1) break;v=j;for(j=0;jv;j+)(if(strcmp(w,)=0)c=j;fclose(fp);fp=fopen(data.txt,wb);for(j=0;jv;j+)(if(j!=c)fwrite(&danj,sizeof(struct system),1,fp);fclose(fp);printf(Delete OK!n);i-;3 瀏覽模塊:在用戶按下菜單后直接顯示出所有歌曲信息。void browse() (int j;FILE *fp;fp=fopen(data.txt,rb);for
9、(j=0;j100;j+)(if(fread(&danj,sizeof(struct system),1,fp)=1)(printf(Name:%sn,);printf(Author:%sn,danj.author);printf(Singer:%sn,danj.singer);printf(Outday:%sn,danj.time);printf(n);else break;fclose(fp);4 查找模塊:用戶輸入要查找的歌曲名或歌曲的任意信息,按菜單鍵。void search()(int flag,j,x;char w20;FILE *fp;char v20;prin
10、tf(1)By authorn);printf(2)By singern);printf(3)By namen);printf(Please choose which you want to search:n);scanf(%d,&x);if(x=3)(flag=0;printf(Please input the songs name:);scanf(%s,&w);fp=fopen(data.txt”,rb”);for(j=0;j100;j+)(if(fread(&danj,sizeof(struct system),1,fp)!=1) break;if(strcmp(,w)
11、=0)printf(Name:%sn,);printf(Author:%sn,danj.author);printf(Singer:%sn,danj.singer);printf(Outday:%sn,danj.time);printf(n);flag=1;if(flag=0)printf(Cannot find the song!n);fclose(fp);else if(x=2)(flag=0;printf(Please input the singer:);scanf(%s,&v);fp=fopen(data.txt”,rb”);for(j=0;j100;j+)if(f
12、read(&danj,sizeof(struct system),1,fp)!=1) break;if(strcmp(danj.singer,v)=0)(printf(Name:%sn,);printf(Author:%sn,danj.author);printf(Singer:%sn,danj.singer);printf(Outday:%sn,danj.time);printf(n);flag=1;if(flag=0)printf(Cannot find the song!n);fclose(fp);else if(x=1)(flag=0;printf(Please in
13、put the author:);scanf(%s,w);fp=fopen(data.txt”,rb”);for(j=0;j100;j+)(if(fread(&danj,sizeof(struct system),1,fp)!=1) break;if(strcmp(danj.author,w)=0)(printf(Name:%sn,);printf(Author:%sn,danj.author);printf(Singer:%sn,danj.singer);printf(Outday:%sn,danj.time);printf(n);flag=1;if(flag=0)prin
14、tf(Cannot find the song!n);fclose(fp);else printf(Error!n);(圖8)整個程序的流程圖如上圖8五上機操作1.主菜單函數(shù)2輸入模塊3. DzTROGRA-IWn-TCprojectsnoname.eKeWe leone to the songfJ system*by long4 MENUmxwx - Enter-Delete-Browse.Search.exitPiecise chouse tie imnitieri = 1Please input the a Lit hop:3.刪除模塊4瀏覽模塊.DfPROGRAHWn-TCprojec
15、tsnoname-exe - Enter.Delete-Browse.Search - exitPlease choose t Jie nmritiei : 3Name :doneff cncfpoH Lit hor: f an gwe ns hanK in g-cr: slio u j ie lunOutday:20S6.7.7We leone to the songfJ system*by long丙 口人 MENU 人(J X-Enter-Delete - D:r口wwc-Search-exitPlease choose the nuinhei:5.查找模塊按作者查找:按演唱者查找:Df
16、PROGRAHWn-TCprojectsnoname-exePlease choose tlie nuinhei : 4By authorBy singerBy namePlease choose which you uant to search:2Please input the s inger:zhouj ieLunMarne : donGnpoA Lit hor: f an gwe ns hanS in g-cr: slio u j ie lunOutday:2006.7.7We leone to the songfJ system*by long丙 口人 MENU 人(J X-Ente
17、r-Delete - D:r口wwc-Search-exitPlease choose tlie nuinhei:按歌曲名字查找:6.退出模塊DfPROGRAHWn-TCprojectsnoname-exe - Enter.Delete-Browse.Search - exitPlease choose t Jie nmritiei : 3Name :doneff cncfpoH Lit hor: f an gwe ns hanK in g-cr: slio u j ie lunOutday:20S6.7.7We leone to the songfJ system*by long丙 口人 M
18、ENU 人(J X-Enter-Delete - D:r口wwc-Search-exit學習心得通過此次C語言程序設計實踐,我實在是獲益匪淺!剛開始對C語 言基本上是什么都不懂,當要開始設計的時候,還真不知從哪下手!結(jié) 果,第一次的上機,就真的不知道干什么了,后來只寫了幾個預處理命 令。一開始做題,也是有點模糊,在指導老師的指導下,我們慢 慢的進入狀態(tài),我做的是一個歌曲管理系統(tǒng),內(nèi)容包括很多。運用的 函數(shù)也是非常的復雜,首先完成了結(jié)構(gòu)體,經(jīng)過幾天的努力,我完成 了大半個程序,但是總是有很多錯誤出現(xiàn),有好多是些小問題,這都 是我的粗心大意造成的,所以設計程序一定要仔細,不容一點的馬虎。 當然也有
19、大問題,關于文件的操作,是我們最大的問題,不過,我們 做好后,經(jīng)過老師的講解和改錯,我們也懂得設計和運用了。同時, 也讓我知道了,不懂就要問,沒有老師和同學的幫助,我也不能在規(guī) 定時間內(nèi)完成。這次設計,讓我重新掌握了C語言,而且還得到了用C語言解決實 際問題的寶貴經(jīng)驗,也從中學到了很多東西。讓我懂得了做什么事都 要有耐心,要有對什么事都認真仔細的品質(zhì)。還有老師的幫助與指導, 讓我學會了很多以前不懂的東西,使我更加意識到實踐的重要性!六、算法和系統(tǒng)的優(yōu)缺點:此系統(tǒng)的最大有點是簡潔,易懂易操作。其中的信息都以文件 儲存,便于調(diào)用。但是次系統(tǒng)不能夠在刪除的時候按照操作者的想要 的方式進行刪除。另外在
20、退出系統(tǒng)后直接退出了系統(tǒng)。改進思路:在刪除模塊中加入可選擇的刪除模式,達到如查找模塊一樣的可選擇 模式刪除。另外在退出系統(tǒng)模塊中加入返回主菜單功能。七:原代碼(附錄)#include #include #include #include int i=0;struct system(char author20;char singer20;char time20;char name20; dan100;void enter()(int j;char c2;FILE *fp;if(fp=fopen(data.txt,w)=NULL)(printf(Can not open the file!n);e
21、xit(0);for(j=0;ji;j+)(fwrite(&danj,sizeof(struct system),1,fp);while(1)(printf(Please input the author:n);scanf(%s,dani.author);printf(Please input the songs name:n);scanf(%s,);printf(Please input the singer:n);scanf(%s,dani.singer);printf(Please input the outday:n);scanf(%s,dani.time);if(f
22、write(&dani+,sizeof(struct system),1,fp)!=1) printf(File write errorn);else printf(Successful!n);printf(Is there any more?( Yesy/Non) n);scanf(%s,c);if(strcmp(c,n)=0)break;fclose(fp);void delete()(int j,v,c;char w20;FILE *fp;printf(Please input the songname which you want to delete:); scanf(%s,w);fp
23、=fopen(data.txt”,rb”);for(j=0;j100;j+)(if(fread(&danj,sizeof(struct system),1,fp)!=1) break;v=j;for(j=0;jv;j+)(if(strcmp(w,)=0)c=j;fclose(fp);fp=fopen(data.txt”,wb”);for(j=0;jv;j+)(if(j!=c)fwrite(&danj,sizeof(struct system),1,fp);fclose(fp);printf(Delete OK!n);i-;void browse()(int j;FILE *f
24、p;fp=fopen(data.txt,rb);for(j=0;j100;j+)(if(fread(&danj,sizeof(struct system),1,fp)=1)(printf(Name:%sn,);printf(Author:%sn,danj.author);printf(Singer:%sn,danj.singer);printf(Outday:%sn,danj.time);printf(n);else break;fclose(fp);void search()(int flag,j,x;char w20;FILE *fp;char v20;printf(1)
25、By authorn);printf(2)By singern);printf(3)By namen);printf(Please choose which you want to search:n);scanf(%d,&x);if(x=3)(flag=0;printf(Please input the songs name:);scanf(%s,&w);fp=fopen(data.txt”,rb”);for(j=0;j100;j+)(if(fread(&danj,sizeof(struct system),1,fp)!=1) break;if(strcmp(,w)=0)(p
26、rintf(Name:%sn,);printf(Author:%sn,danj.author);printf(Singer:%sn,danj.singer);printf(Outday:%sn,danj.time);printf(n);flag=1;if(flag=0)printf(Cannot find the song!n);fclose(fp);else if(x=2)(flag=0;printf(Please input the singer:);scanf(%s,&v);fp=fopen(data.txt,rb);for(j=0;j100;j+)(if(fread(&danj,sizeof(struct system),1,fp)!=1) break;if(strcmp(danj.singer,v)=0)(printf(Name:%sn,);printf(Author:%sn,danj.author);printf(Singer:%sn,danj.singer);printf(Outday:%sn,danj.time);printf(n);flag=1;if(flag=0)printf(Cannot find the song!n);fclose(fp);else if(
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 用維修基金維修電梯主機軸承合同
- 生態(tài)項目投資合作協(xié)議書(2篇)
- 路面磚產(chǎn)品質(zhì)量監(jiān)督抽查實施細則
- 湘教版數(shù)學八年級上冊1.1《分式的基本性質(zhì)》聽評課記錄1
- 五年級小數(shù)乘法口算練習題
- 七年級(人教版)集體備課聽評課記錄:2.2《整式的加減(3)》
- 五年級數(shù)學下冊聽評課記錄《2因數(shù)與倍數(shù)2-2、5、3的倍數(shù)的特征》(人教版2)
- 中等裝修房屋長期出租協(xié)議書范本
- 二零二五年度風機采購合同合同履行監(jiān)督與審計
- 2025年度荒山承包經(jīng)營權租賃與生態(tài)修復合同
- 天津在津居住情況承諾書
- PHOTOSHOP教案 學習資料
- 初中數(shù)學教學“教-學-評”一體化研究
- 2012年安徽高考理綜試卷及答案-文檔
- 《游戲界面設計專題實踐》課件-知識點5:圖標繪制準備與繪制步驟
- 自動扶梯安裝過程記錄
- MOOC 材料科學基礎-西安交通大學 中國大學慕課答案
- 智慧供熱管理系統(tǒng)方案可行性研究報告
- 帕金森病的言語康復治療
- 中國城市居民的健康意識和生活方式調(diào)研分析報告
- 上海星巴克員工手冊
評論
0/150
提交評論