![C語言課程設(shè)計(jì)__歌曲信息管理系統(tǒng)_第1頁](http://file4.renrendoc.com/view/8a38ee9c7ea5d3606dba45c2b6d14975/8a38ee9c7ea5d3606dba45c2b6d149751.gif)
![C語言課程設(shè)計(jì)__歌曲信息管理系統(tǒng)_第2頁](http://file4.renrendoc.com/view/8a38ee9c7ea5d3606dba45c2b6d14975/8a38ee9c7ea5d3606dba45c2b6d149752.gif)
![C語言課程設(shè)計(jì)__歌曲信息管理系統(tǒng)_第3頁](http://file4.renrendoc.com/view/8a38ee9c7ea5d3606dba45c2b6d14975/8a38ee9c7ea5d3606dba45c2b6d149753.gif)
![C語言課程設(shè)計(jì)__歌曲信息管理系統(tǒng)_第4頁](http://file4.renrendoc.com/view/8a38ee9c7ea5d3606dba45c2b6d14975/8a38ee9c7ea5d3606dba45c2b6d149754.gif)
![C語言課程設(shè)計(jì)__歌曲信息管理系統(tǒng)_第5頁](http://file4.renrendoc.com/view/8a38ee9c7ea5d3606dba45c2b6d14975/8a38ee9c7ea5d3606dba45c2b6d149755.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、C語言課程設(shè)計(jì)實(shí)習(xí)報(bào)告專 業(yè):學(xué) 號(hào):班級(jí)序號(hào):姓 名:指導(dǎo)教師:C語言程序設(shè)計(jì)報(bào)告(實(shí)習(xí)日期:2010-8至2010-9)一、C語言課程設(shè)計(jì)的目的:高級(jí)語言課程設(shè)計(jì)是學(xué)習(xí)完高級(jí)語言程序設(shè)計(jì)課程后進(jìn)行的一次全面的 綜合性上機(jī)實(shí)驗(yàn)。其目的在于為同學(xué)提供了一個(gè)既動(dòng)手又動(dòng)腦,獨(dú)立實(shí)踐的機(jī)會(huì), 將課本上的理論知識(shí)和實(shí)際有機(jī)的結(jié)合起來,鍛煉同學(xué)的分析解決實(shí)際問題的能 力。提高學(xué)生適應(yīng)實(shí)際,實(shí)踐編程的能力。二、題目:歌曲信息管理系統(tǒng)需求分析:制作一個(gè)歌曲信息管理系統(tǒng)使之有以下功能1歌曲信息包括歌曲名,作者,演唱者,發(fā)行年月等。2可以對(duì)歌曲信息進(jìn)行輸入,刪除,瀏覽。3可以查詢歌曲名,作者,演唱者信息。4可以
2、提供按作者顯示功能。5用文件存儲(chǔ)信息。三、總體設(shè)計(jì)根據(jù)分析,整個(gè)系統(tǒng)可設(shè)計(jì)為以下4個(gè)模塊:信息輸入模塊,刪除模塊,瀏覽模塊。查找模塊。歌曲管理系統(tǒng)I)信息輸入:依次按順序結(jié)構(gòu)輸入歌曲名,作者,演唱者,發(fā)行年月。(圖2)信息刪除:根據(jù)輸入的歌曲名,作者,演唱者等一項(xiàng)可以刪除對(duì)應(yīng)的其他項(xiàng)刪除模塊(delete)輸入歌曲名(enter name)I)輸入作者(enter author),)輸入演唱者(enter singer)(圖3)信息瀏覽:可以直接瀏覽歌曲,作者,演唱者,發(fā)行年月。轍曲瀏覽V)例覽作者瀏覽歌曲名瀏覽演唱者 f瀏覽日期(圖4)信息查找:可以查找歌曲,作者等。并且可以選擇查找的方式:
3、按作曲者、 按演唱者、按歌曲名字。(圖5)退出模塊點(diǎn)擊直接退出四詳細(xì)設(shè)計(jì)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ù)據(jù)輸出以及各種函數(shù)的調(diào)用。 其中各功能模塊用菜單方式選擇;另外,部分菜單也可以寫成函數(shù)。void main()(void menu();void function1();void function2();void function3();
4、void function4();menu();return;題目對(duì)應(yīng)具體的程序如下: 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各功能模塊設(shè)計(jì)(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刪除模塊:用戶輸入要?jiǎng)h除的信息,如輸入歌曲名,根據(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)整個(gè)程序的流程圖如上圖8五上機(jī)操作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學(xué)習(xí)心得通過此次C語言程序設(shè)計(jì)實(shí)踐,我實(shí)在是獲益匪淺!剛開始對(duì)C語 言基本上是什么都不懂,當(dāng)要開始設(shè)計(jì)的時(shí)候,還真不知從哪下手!結(jié) 果,第一次的上機(jī),就真的不知道干什么了,后來只寫了幾個(gè)預(yù)處理命 令。一開始做題,也是有點(diǎn)模糊,在指導(dǎo)老師的指導(dǎo)下,我們慢 慢的進(jìn)入狀態(tài),我做的是一個(gè)歌曲管理系統(tǒng),內(nèi)容包括很多。運(yùn)用的 函數(shù)也是非常的復(fù)雜,首先完成了結(jié)構(gòu)體,經(jīng)過幾天的努力,我完成 了大半個(gè)程序,但是總是有很多錯(cuò)誤出現(xiàn),有好多是些小問題,這都 是我的粗心大意造成的,所以設(shè)計(jì)程序一定要仔細(xì),不容一點(diǎn)的馬虎。 當(dāng)然也有
19、大問題,關(guān)于文件的操作,是我們最大的問題,不過,我們 做好后,經(jīng)過老師的講解和改錯(cuò),我們也懂得設(shè)計(jì)和運(yùn)用了。同時(shí), 也讓我知道了,不懂就要問,沒有老師和同學(xué)的幫助,我也不能在規(guī) 定時(shí)間內(nèi)完成。這次設(shè)計(jì),讓我重新掌握了C語言,而且還得到了用C語言解決實(shí) 際問題的寶貴經(jīng)驗(yàn),也從中學(xué)到了很多東西。讓我懂得了做什么事都 要有耐心,要有對(duì)什么事都認(rèn)真仔細(xì)的品質(zhì)。還有老師的幫助與指導(dǎo), 讓我學(xué)會(huì)了很多以前不懂的東西,使我更加意識(shí)到實(shí)踐的重要性!六、算法和系統(tǒng)的優(yōu)缺點(diǎn):此系統(tǒng)的最大有點(diǎn)是簡(jiǎn)潔,易懂易操作。其中的信息都以文件 儲(chǔ)存,便于調(diào)用。但是次系統(tǒng)不能夠在刪除的時(shí)候按照操作者的想要 的方式進(jìn)行刪除。另外在
20、退出系統(tǒng)后直接退出了系統(tǒng)。改進(jìn)思路:在刪除模塊中加入可選擇的刪除模式,達(dá)到如查找模塊一樣的可選擇 模式刪除。另外在退出系統(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等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 新版通 用規(guī)范對(duì)設(shè)計(jì)影響交流分享
- 2025年撫順師范高等專科學(xué)校高職單招高職單招英語2016-2024歷年頻考點(diǎn)試題含答案解析
- 山西省孝義市高三上學(xué)期入學(xué)摸底考試語文試題(含答案)
- 滬教版(上海)七年級(jí)地理第一學(xué)期中國區(qū)域篇(上)1.2《臺(tái)灣省》聽課評(píng)課記錄
- 中班幼兒系列活動(dòng)策劃方案五篇
- 2025年科學(xué)儀器行業(yè)技術(shù)革新與發(fā)展前景
- 鋼材購銷合同范文年
- 代償協(xié)議與擔(dān)保合同
- 跨境貿(mào)易線上支付服務(wù)合同
- 投資公司借款的合同樣本
- 醫(yī)保政策與健康管理培訓(xùn)計(jì)劃
- 無人化農(nóng)場(chǎng)項(xiàng)目可行性研究報(bào)告
- 2024屆上海市金山區(qū)高三下學(xué)期二模英語試題(原卷版)
- 學(xué)生春節(jié)安全教育
- 2024-2025年校長在教研組長和備課組長會(huì)議上講話
- 宏觀利率篇:債券市場(chǎng)研究分析框架
- 橋梁頂升移位改造技術(shù)規(guī)范
- 六年級(jí)語文(上冊(cè))選擇題集錦
- 《游戲界面設(shè)計(jì)專題實(shí)踐》課件-知識(shí)點(diǎn)5:圖標(biāo)繪制準(zhǔn)備與繪制步驟
- MOOC 材料科學(xué)基礎(chǔ)-西安交通大學(xué) 中國大學(xué)慕課答案
- 復(fù)產(chǎn)復(fù)工試題含答案
評(píng)論
0/150
提交評(píng)論