個人賬簿管理系統(tǒng)_第1頁
個人賬簿管理系統(tǒng)_第2頁
個人賬簿管理系統(tǒng)_第3頁
免費(fèi)預(yù)覽已結(jié)束,剩余16頁可下載查看

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、學(xué) 號:課程設(shè)計課程設(shè)計任務(wù)書20112012學(xué)年題目個人賬簿管理系統(tǒng)第一學(xué)期學(xué)生姓名:教學(xué)院計算機(jī)專業(yè)班級:10信息管理專業(yè)信息管理指導(dǎo)教師:班級工作部門:計算機(jī)學(xué)院姓名201412-月30日、課程設(shè)計題目:指導(dǎo)教師個人賬簿管理系統(tǒng)二、課程設(shè)計內(nèi)容個人帳簿管理系統(tǒng)記錄某人每月的全部收入及各項幵支情況,包括食品消費(fèi),房租,子女教育費(fèi)用,水電費(fèi),醫(yī)療費(fèi),儲蓄等。該系統(tǒng)采用了Win dowsXP操作系統(tǒng)結(jié)合Visual C+ 6.0,TC 2.0 等軟件幵發(fā),可以輸入和修改某月的收支情況,可以對每月 的幵支從小到大進(jìn)行排序,可以根據(jù)輸入的月份查詢每月的收支情況。三、進(jìn)度安排1. 系統(tǒng)設(shè)計,確定函數(shù)

2、功能及其實(shí)現(xiàn)過程;2. 根據(jù)前面的結(jié)果,編寫程序清單,進(jìn)行調(diào)試;3. 經(jīng)過反復(fù)的編譯,調(diào)試,測試,程序運(yùn)行成功;4. 撰寫課程設(shè)計報告,完成整個論文報告的工作,并打??;課題答辯。四、基本要求1. 初步完成總體設(shè)計,搭好框架,確定人機(jī)對話的界面,確定函數(shù)個數(shù);2. 完成最低要求:建立一個文件,包括某人5個月的收支情況,能對文件中的信息進(jìn)行擴(kuò)充(追加),修改和刪除;3. 進(jìn)一步要求:完成對每月的幵支排序,以及完成系統(tǒng)查詢功能;4. 應(yīng)提供一個界面來調(diào)用各個功能,調(diào)用界面和各個功能的操作界面應(yīng)盡可能清晰美 觀。目錄一概述 1二總體方案設(shè)計 11. 整體設(shè)計思路 12. 輸入系統(tǒng) 13 .排序系統(tǒng) 2

3、4. 查詢系統(tǒng) 25. 刪除系統(tǒng) 26. 其他部分函數(shù)功能 2三命令行界面代碼 3四 程序的調(diào)試與運(yùn)行結(jié)果說明 13五課程設(shè)計總結(jié) 13參考文獻(xiàn) 14數(shù)據(jù)結(jié)構(gòu)課程設(shè)計成績評定表 14一概述該課程設(shè)計主要設(shè)計個人賬簿管理系統(tǒng)已記錄某人每月的全部收入及各項開支情況,包括食品消費(fèi),房租,子女交用費(fèi)用,水電費(fèi),醫(yī)療費(fèi),儲蓄等。在課程設(shè)計中,用到了 C語言以及數(shù) 據(jù)結(jié)構(gòu)中的相關(guān)知識,當(dāng)然也有少數(shù)參考了其他人對某些問題的處理經(jīng)驗。對于進(jìn)入系統(tǒng)后可以輸入和修改某月的收支情況,可以對每月的開支從小到大進(jìn)行排序,可以根據(jù)輸入的月份查詢每月的收支情況,可以對某月的開支進(jìn)行刪除操作。二總體方案設(shè)計1. 整體設(shè)計思路

4、系統(tǒng)共分五個子系統(tǒng):信息輸入,信息瀏覽及排序,信息查詢,信息更改,文件操作。在相應(yīng)的系統(tǒng)內(nèi)可完成相應(yīng)的功能。各模塊相對獨(dú)立,每個模塊用一個大型的函數(shù)來處理數(shù)據(jù)。主程序:1、信息輸入2、信息瀏覽及排序3、信息查詢4 、信息更改5、文件操作0 、退出管理系統(tǒng)2. 輸入系統(tǒng)功能:輸入數(shù)據(jù),然后將數(shù)據(jù)寫入文件。算法:int enter(MYBILL t)for(i=0;i n ;i+)sea nf(%s%s%s%s%s%s%s,ti.mo nth,ti.spxf,ti.fzfy,ti.znjy,ti.sdfy,ti.ylfy,ti.cxfy);f=atof(ti.spxf)+atof(ti.fzfy)

5、+atof(ti.znjy)+atof(ti.sdfy)+atof(ti.ylfy)+atof(ti.cxfy);spri ntf(ti.srfy,%.2f,f);void save(MYBILL t,i nt n)for(i=0;i n ;i+)fprin tf(fp,%-8s%4s%13s%8s%7s%12s%8s%12s,ti.m on th,ti.spxf,ti.fzfy,ti.znjy, ti.sdfy,ti.ylfy,ti.srfy,ti.cxfy);fprin tf(fp,rn);3 .排序系統(tǒng)功能:1、按月份排序 2、按輸入排序算法:void monthsort(MYBILL

6、t,int n)for(i=0;i n ;i+)flag=O; for(j=0;j0) flag=1;temp=tj;tj=tj+1; tj+1=temp;if(flag=0)break; void srfysort(MYBILL t,i nt n)for(i=0;i n ;i+) flag=0; for(j=0;j0)flag=1; temp=tj; tj=tj+1;tj+1=temp; if(flag=0)break; 4. 查詢系統(tǒng)功能:按月份循序查找,調(diào)用輸出函數(shù)輸出算法:void monthsearch(MYBILL t,int n)for(i=0;i n;+i)if(strcmp(

7、s,ti.mo nth)=0)mprint(ti); break; void mprin t(MYBILL temp)prin tf(%8s%6s%10s%10s%10s%10s%10s%10sn,temp.mo nth,temp.spxf,temp.fzfy,temp.znj y,temp.sdfy,temp.ylfy,temp.cxfy,temp.srfy);5. 刪除系統(tǒng)功能:先是查找要刪除的月份賬單,然后對其刪除,刪除某月賬單后,其他的月份依次向前移 動刪除信息算法:int delet(MYBILL t,int n)for(j=i+1;j #in elude conio. typede

8、f struct char monthchar spxf5char sdfy5息更息命令行界面代碼操10;列出操作目錄選擇要操作編號結(jié)束char ylfy5;char cxfy5;char fzfy5; char zn jy5;char srfy20;MYBILL;void mprin t(MYBILL temp)prin tf( 月份食品消費(fèi)房租費(fèi)用子女費(fèi)用水電費(fèi)用醫(yī)療費(fèi)用儲蓄費(fèi)用本月收 入 n);n);prin tf(%8s%6s%10s%10s%10s%10s%10s%10sn,temp.mo nth,temp.spxf,temp.fzfy,temp.znjy, temp.sdfy,te

9、mp.ylfy,temp.cxfy,temp.srfy);/輸入信息int en ter(MYBILL t)int i,n;double f;system(cls);printf(請確定您要輸入幾個月的賬單:);sca nf(%d,&n);if(n0)printf(請輸入您的個人賬單信息:n);n);printf(-n);for(i=0;i n ;i+)sea nf(%s%s%s%s%s%s%s,ti.mo nth,ti.spxf,ti.fzfy,ti.znjy,ti.sdfy,ti.ylfy,ti.cxfy);f=atof(ti.spxf)+atof(ti.fzfy)+atof(ti.znj

10、y)+atof(ti.sdfy)+atof(ti.ylfy)+ato f(ti.cxfy);spri ntf(ti.srfy,%.2f,f);printf(-n);printf( 信息錄入成功!);return n;if(*=0) prin tf(對不起,您輸入的月數(shù)不正確!n);exit(0);/輸出 void list(MYBILL t,i nt n) int i;system(cls);個人賬簿信息總共有%d個月的賬單printf( * *n);printf( n, n);儲蓄費(fèi)用本月printf(月份 食品消費(fèi) 房租費(fèi)用子女費(fèi)用水電費(fèi)用 醫(yī)療費(fèi)用收入n);for(i=0;i n;i+)

11、prin tf(%8s%6s%10s%10s%10s%10s%10s%10sn,ti.mo nth,ti.spxf,ti.fzfy,ti.znjy, ti.sdfy,ti.ylfy,ti.cxfy,ti.srfy);if(i+1)%10=0)printf(請輸入任意鍵繼續(xù).n);getchar();/根據(jù)月份查找,參數(shù)有結(jié)構(gòu)體變量,長度,字符指針int monthfin d(MYBILL t,i nt n,char *s)int i;for(i=0;i n-1)printf(對不起,沒有找到要刪除的月份的賬單!n);elsempri nt(ti);printf(您確認(rèn)要刪除該月的賬單么?(1.

12、是/0.否)n);scan f(%d,&ch);if(ch=1)for(j=i+1;j n-1)printf(對不起,沒有找到要修改的記錄!n);elsempri nt(ti);printf(您確定要修改這條記錄么?(1.是/0.否)n);scan f(%d,&ch);if(ch=1)printf(請輸入新的記錄n);printf(月份 食品消費(fèi) 房租費(fèi)用 子女教育費(fèi)用 水電費(fèi)用 醫(yī)療費(fèi)用n);printf(”n);sca nf(%s%s%s%s%s%s%s,ti.mo nth,ti.spxf,ti.fzfy,ti.znjy, ti.sdfy,ti.ylfy,ti.cxfy);f=atof(t

13、i.spxf)+atof(ti.fzfy)+atof(ti.znjy)+atof(ti.sdfy)+atof(ti.ylfy)+ato f(ti.cxfy);spri ntf(ti.srfy,%.2f,f);printf(”n);printf(記錄修改成功!n);/添加信息int add(MYBILL t,i nt n)MYBILL temp;int i,j;double f;char s20;printf(請輸入您要插入的記錄:n);prin tf(月份食品消費(fèi)房租費(fèi)用子女教育費(fèi)用水電費(fèi)用醫(yī)療費(fèi)用printf(-n);sca nf(%s%s%s%s%s%s%s,temp.m on th,te

14、mp.spxf,temp.fzfy,temp.znjy, temp.sdfy,temp.ylfy,temp.cxfy);f=atof(temp.spxf)+atof(temp.fzfy)+atof(temp.z njy )+atof(temp.sdfy)+atof(temp.ylfy)+ato f(temp.cxfy);spri ntf(temp.srfy,%.2f,f);printf(-n);printf(請輸入您要插入的位置:n);sca nf(%s,s);i=mo nthfi nd(t, n, s); /根據(jù)查找月份,找到要添加的位置for(j=n-1;j=i;j-)strcpy(tj+

15、1.m on th,tj.mo nth);strcpy(tj+1.spxf,tj.spxf);strcpy(tj+1.fzfy,tj.fzfy);strcpy(tj+1.znjy,tj.znjy);strcpy(tj+1.sdfy,tj.sdfy);strcpy(tj+1.ylfy,tj.ylfy);strcpy(tj+1.cxfy,tj.cxfy);strcpy(tj+1.srfy,tj.srfy);strcpy(ti.m on th,temp.mo nth);/在最后添力卩strcpy(ti.spxf,temp.spxf);strcpy(ti.fzfy,temp.fzfy);strcpy(

16、ti.znjy,temp.znjy);strcpy(ti.sdfy,temp.sdfy);strcpy(ti.ylfy,temp.ylfy);strcpy(ti.cxfy,temp.cxfy);strcpy(ti.srfy,temp.srfy);n+;prin tf(記錄插入成功! n);return n;/寫入文件void save(MYBILL t,i nt n)int i;FILE *fp;if(fp=fope n(mybill.txt,wb)=NULL)prin tf(文件不能打開! n);exit(1);fprin tf(fp,%d, n);fprin tf(fp,rn);for(i

17、=0;i n;i+)fprin tf(fp,%-8s%4s%13s%8s%7s%12s%12s%8s,ti.mo nth,ti.spxf,ti.fzfy,ti.znjy, ti.sdfy,ti.ylfy,ti.cxfy,ti.srfy);fprin tf(fp,rn);fclose(fp);/讀取文件in t load(MYBILL t)int i,n;FILE *fp;if(fp=fope n(mybill.txt,rb)=NULL)只讀取文件printf( 對不起,不能打開文件! n);exit(1);fsca nf(fp,%d,&n);for(i=0;i n;i+)fscan f(fp,

18、%s%s%s%s%s%s%s%s,ti.mo nth,ti.spxf,ti.fzfy,ti.znjy, ti.sdfy,ti.ylfy,ti.cxfy,ti.srfy);fclose(fp);return n;/按月份排序void mon thsort(MYBILL t,i nt n)int i,j,flag;MYBILL temp;for(i=0;i n;i+)flag=0;for(j=0;j0)前后兩個字符串相互比較flag=1;temp=tj;tj=tj+1;tj+1=temp;if(flag=0)break;prin tf(按月份排序成功! n);/按收入排序void srfysort

19、(MYBILL t,i nt n)int i,j,flag;MYBILL temp;for(i=0;i n;i+)flag=0;for(j=0;j0)flag=1;temp=tj;tj=tj+1;tj+1=temp;if(flag=0)break;printf(按每月收入排序成功!n);/另生成新文件void copy()char outfile20;int i,n;MYBILL t;FILE *sfp,*tfp;if(sfp=fope n(mybill.txt,rb)=NULL)printf(對不起,不能打開您所需要的文件!n);exit(1);printf(請輸入目標(biāo)文件名,例如:c:f1

20、mybill.txtn);scan f(%s,outfile);if(tfp=fope n( outfile,wb)=NULL)printf(對不起,不能打開您所需要的文件!n);exit(1);fscanf(sfp,%d,&n);/從 sfp 中讀取文件fprintf(tfp,%d,n);寫入 tfp 中fprin tf(tfp,rn);for(i=0;i n;i+)fscan f(sfp,%s%s%s%s%s%s%s%s,t.mo nth,t.spxf,t.fzfy,t.znjy,t.sdfy,t.ylfy,t.cxfy,t.srfy);fprin tf(tfp,%-8s%4s%13s%8

21、s%7s%12s%12s%8s,t.mo nth,t.spxf,t.fzfy,t.znjy,t.sdfy,t.ylfy,t.cxfy,t.srfy);fprin tf(tfp,rn);fclose(sfp);fclose(tfp);/根據(jù)月份查找,參數(shù)結(jié)構(gòu)體,長度void mon thsearch(MYBILL t,i nt n)char s20;int i;printf( 請輸入您要查找的月份:);sca nf(%s,s);for(i=0;i n;+i)if(strcmp(s,ti.m on th)=0)mpri nt(ti); /輸出該月信息break;if (i=n)printf(對不起

22、,查找不到您所需要的信息!);void showpaixu(MYBILL bill,i nt len gth)int choice;men u1:system(cls);小 “;K-kJ-f/*、nn);prin tf(1.prin tf(2.prin tf(3.prin tf(0.printf();個人賬簿信息管理系統(tǒng)顯示全部信息nn); 按月份順序排序nn); 按每月收入排序nn); 返回上一級菜單nn);請選擇(0-3)nsca nf(%d,&choice);switch(choice)case 1: len gth=load(bill);請按任意鍵返回.n);list(bill,le

23、ngth); printf( getch();break;case 2: len gth=load(bill); mon thsort(bill,le ngth); list(bill,le ngth);save(bill,le ngth); printf( getch();break;case 3: len gth=load(bill); srfysort(bill,le ngth);Iist(bill,le ngth);請按任意鍵返回.n);save(bill,le ngth);printf( getch(); break;case 0: retur n;goto men u1;void

24、chazhao(MYBILL bill,i nt len gth)int choice; menu2:system(cls);printf( * *nn);1.0.printf(printf(printf();sca nf(%d,&choice);switch(choice)case 1: len gth=load(bill); mon thsearch(bill,le ngth);printf(請按任意鍵返回.ngetch(); break;case 0: retur n;個人賬簿信息管理系統(tǒng)通過月份查詢nn);返回上一級菜單nn) 請選擇(0-1) : n);個人賬簿管理系統(tǒng)刪除記錄nn)

25、;修改記錄nn);添加記錄nn);返回上一級菜單nn)請選擇(0-3) : ngoto menu2;void bia ngen g(MYBILL bill,i nt len gth) int choice;menu3:system(cls);printf( * *nn);prin tf(1.prin tf(2.prin tf(3.prin tf(0.printf(sca nf(%d,&choice);switch(choice)case 1: len gth=load(bill);len gth=delet(bill,le ngth); save(bill,le ngth);printf( g

26、etch();break;case 2: len gth=load(bill); rewrite(bill,le ngth); save(bill,le ngth); printf( getch();break;case 3: len gth=load(bill); len gth=add(bill,le ngth); save(bill,le ngth); printf( getch();break;case 0: retur n;goto menu3;void wenjia n(MYBILL bill,i nt len gth) int choice;menu4:請按任意鍵返回.n);請按

27、任意鍵返回.n);請按任意鍵返回.n);system(cls);printf( * *nn);1.2.0.個人賬簿管理系統(tǒng)printf(printf(printf(printf();sca nf(%d,&choice);switch(choice)case 1: len gth=load(bill);prin tf(您已經(jīng)成功的將文件保存!prin tf(請按任意鍵返回getch();break;case 2: copy();printf( printf( getch();break;case 0: retur n;goto menu4;保存文件nn); 另存新文件nn);返回上一級菜單nn)

28、; 請選擇(0-2) : n新文件生成! n);請按任意鍵返回n);.n);void mai n()int choice; in t le ngth;MYBILL bill20;menu:system(cls);個人賬簿管理系統(tǒng)請選擇以下賬簿管理功能:nn);信息輸入nn);信息瀏覽及排序nn);信息查詢nn);信息更改nn);文件操作nn); 退出管理系統(tǒng)nn);請選擇(0-5) : n );printf( *、nn);1.2.3.4.5.0.printf(printf(printf(printf(printf(printf(printf( printf( scan f(%d,&choice); switch(choice)請按任意鍵返回.n);case 1: len gth=e nter(bill); save(bill,le ngth);prin tf(n getch();break;case 2: showpaixu(bill,le ngth);break; case 3: chazhao(bill,le ngth);break; case 4: bia ngen g(bill,le ngth);break; case 5: wen jia n( bill,le ngth);break; case 0: re

溫馨提示

  • 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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論