家庭财务小管家(共33页)_第1页
家庭财务小管家(共33页)_第2页
家庭财务小管家(共33页)_第3页
家庭财务小管家(共33页)_第4页
家庭财务小管家(共33页)_第5页
已阅读5页,还剩28页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、精选优质文档-倾情为你奉上课程设计说明书学 院、系:专 业:学 生 姓 名:学 号:设 计 题 目:家庭财务小管家 起 迄 日 期:指 导 教 师:1 设计目的 本课程设计是采用C语言,在VC平台下设计年历显示系统,该系统运行在MS-DOS命令行模式下。本课程设计为学生提供了一个既动手又动脑,独立实践的机会,将课本上的理论知识和实际有机的结合起来,锻炼学生的分析解决实际问题的能力。提高学生适应实际,实践编程的能力。1) 进一步巩固和复习C程序设计的基础知识;2) 培养学生结构化程序、模块化程序设计的方法和能力;3) 了解软件的编制过程及各环节的具体内容;4) 提高学生程序调试技巧、软件设计能力

2、和代码规范化等素质;提高学生分析问题、解决问题以及实际运用能力。 2 任务概述个人小管家应用系统给家庭提供了一个管理个人财务的平台,主要用于对家庭成员收入、支出进行添加、查询、删除、修改以及打印的操作,使得家庭财务收支状况一目了然。主要功能包括:(1) 主菜单。主要包括收入管理、支出管理和退出;(2) 添加收入记录;(3) 查询收入记录;(4) 删除收入记录;(5) 修改收入记录;(6) 打印收入记录;(7) 添加支出记录;(8) 查询支出记录;(9) 删除支出记录;(10) 修改支出记录;(11) 打印支出记录;(12) 退出系统。 3 模块划分家庭财务小管家统计操作 退出支出操作收入操作返

3、回上级总资金 总支出 总收入返回上级修改收入显示收入查询收入删除收入添加收入删除支出查询支出返回上级修改支出显示支出添加支出4 主要函数说明及其N-S图1、主函数 main()Switch(choice)Income()zhichu()Tongji()Quit()default:错误 2、增加函数Add_()输入待加入的家庭成员收支情况 文件存在T F 从该文件读出数据并显示出来 退出确定所要加入的位置向文件输入前面家庭成员收支数据并显示向文件输出待输入的家庭成员收支数据并显示向文件输出位置后面家庭成员收支数据并显示关闭文件 3、删除函数Del_()打开文件 显示读出的数据 关闭文件 N=1输

4、入待删除的家庭成员信息 信息正确 T F 将第j+1个成员的数据 移到第j个 关闭文件4、修改函数xiugai_()打开文件输入需要修改家庭成员的信息显示需要修改家庭成员信息 重新写入各项信息 向文件输入新信息并显示 关闭文件5、查询函数chaxun_()打开文件输入需要查询家庭成员的信息 显示需要查询家庭成员信息关闭文件6、统计函数Tongji_() 打开文件 统计所有家庭成员的收入并显示 统计所有家庭成员的支出并显示 统计所有家庭成员的(收入-支出)并显示 关闭文件5 程序运行数据及其结果1>主界面:图12>收入界面:图23>添加操作:图3(以收入为例)4>查询操作

5、:图4(以收入为例)5>修改操作:图5(以支出为例)6>删除操作:图6(以收入为例)7>支出界面:图78>统计界面:图86 课程设计心得 通过本此的课程设计,让我们更熟练地掌握了C语言程序设计教程的知识,熟悉了一个管理系统的运用和操作,熟悉如何采用Dev C+作为编译环境,使程序成功的编译和运行,能够运用C语言创建基本表和编辑信息,增加信息,删除信息,修改信息,查找信息和显示信息。通过对结构体,编辑,增加,删除,修改,查找,显示模块的连接,生成能操作运行的管理系统。 在这次课程设计的过程中,由于对知识掌握不熟悉,特别是链表、指针和文件的使用不熟练,是自己在编写代码的时候

6、遇到了很大的困难,最后通过上网查找资料并请教学长解决了问题,但自身还是有很多不足的地方! 通过这次课程设计,是自己认识到了基础知识的重要性,在平时的学习中要把基础的内容完全理解融会贯通,并且应该多加练习,提高自己敲写代码的速度和准确性。通过这次课程设计,增加了我对编程的兴趣和欲望。总之,这次课程设计使我受益匪浅!附录:源代码#include<stdio.h>#include<stdlib.h>#include<string.h>struct Datachar name20; char riqi8;float money;char beizhu50;struc

7、t liststruct Data info;struct list *next;struct list *Inhead=NULL;struct list *Intail=NULL;struct list *zhichuhead=NULL;struct list *zhichutail=NULL;struct list *temp=NULL;void chaxun_income();void chaxun_zhichu();void xiugai_income();void xiugai_zhichu();void Save_income() /保存支出文件 FILE *fp; /文件指针 f

8、p=fopen("D:家庭财务管理.txt","w");struct list *p = Inhead;while(p != NULL)fwrite(&p->info, sizeof(struct Data), 1, fp);p = p->next;fclose(fp);void Save_zhichu() /保存支出文件 FILE *fp;fp=fopen("D:家庭财务管理支出.txt","w"); /打开文件 struct list *p = zhichuhead;while(p != N

9、ULL)fwrite(&p->info, sizeof(struct Data), 1, fp);p = p->next;fclose(fp);void Open() FILE *fp;fp=fopen("D:家庭财务管理.txt","r"); /打开文件 if(fp!=NULL)struct Data linshi;while(fread(&linshi, sizeof(struct Data), 1, fp) = 1)temp=(struct list*)malloc(sizeof(struct list);temp-&g

10、t;info=linshi;temp->next=NULL; if(Inhead = NULL)Inhead = temp;Intail = temp;elseIntail->next = temp;Intail = temp; fclose(fp);void Menu() /主菜单 system("cls");printf("=n");printf("#欢迎使用家庭财务小管家#n");printf("=n");printf("1:收入操作 n");printf("2:支出

11、操作 n");printf("3:统计操作 n"); printf("0:退出 n");void Openzhichu() /打开支出文件 FILE *fp;fp=fopen("D:家庭财务管理支出.txt","r");if(fp!=NULL)struct Data linshi;while(fread(&linshi, sizeof(struct Data), 1, fp) = 1)temp=(struct list*)malloc(sizeof(struct list);temp->in

12、fo=linshi;temp->next=NULL; if(zhichuhead = NULL)zhichuhead = temp;zhichutail = temp;elsezhichutail->next = temp;zhichutail = temp; fclose(fp);void mingzi ()/按姓名查询 char chazhao20;printf("请输入查询的名字");gets(chazhao);struct list *p = Inhead;while(p != NULL)if(strcmp(p->,chazhao

13、)=0)printf("姓名:");puts(p->); printf("日期:");puts(p->info.riqi); printf("收入:");printf("%.4fn",p->info.money); printf("备注:");puts(p->info.beizhu);system("PAUSE");p = p->next;if(Inhead!=NULL)char panduan; printf("是否

14、继续查询(Y/N)"); panduan=getchar();fflush(stdin);if(panduan='Y'|panduan='y')chaxun_income();void mingzi_zhichu ()char chazhao20;printf("请输入查询的名字");gets(chazhao);struct list *p = zhichuhead;while(p != NULL)if(strcmp(p->,chazhao)=0)printf("姓名:");puts(p-

15、>); printf("日期:");puts(p->info.riqi); printf("支出:");printf("%.4fn",p->info.money); printf("备注:");puts(p->info.beizhu);system("PAUSE");p = p->next;if(zhichuhead!=NULL)char panduan; printf("是否继续查询(Y/N)"); panduan=getch

16、ar();fflush(stdin);if(panduan='Y'|panduan='y')chaxun_zhichu();void mingzi_xiugai_income()char xiugai20;printf("请输入修改的名字");fflush(stdin);gets(xiugai);struct list *p = Inhead;while(p != NULL)if(strcmp(p->,xiugai)=0) fflush(stdin);printf("姓名:");gets(p->

17、;);fflush(stdin); printf("日期:");gets(p->info.riqi);fflush(stdin); printf("收入: ");scanf("%f",&p->info.money);fflush(stdin); printf("备注:");gets(p->info.beizhu);fflush(stdin); p = p->next;Save_income(); if(Inhead!=NULL)char panduan; print

18、f("是否继续修改(Y/N)"); panduan=getchar();fflush(stdin);if(panduan='Y'|panduan='y')xiugai_income();void mingzi_xiugai_zhichu() /按名字修改支出 char xiugai20;printf("请输入修改的名字");fflush(stdin);gets(xiugai);struct list *p = zhichuhead;while(p != NULL)if(strcmp(p->,xiug

19、ai)=0) fflush(stdin);printf("姓名:");gets(p->);fflush(stdin); printf("日期:");gets(p->info.riqi);fflush(stdin); printf("支出: ");scanf("%f",&p->info.money);fflush(stdin); printf("备注:");gets(p->info.beizhu);fflush(stdin); p = p->

20、next;Save_zhichu();if(zhichuhead!=NULL)char panduan; printf("是否继续修改(Y/N)"); panduan=getchar();fflush(stdin);if(panduan='Y'|panduan='y')xiugai_zhichu();void riqi() /收入查询 char chazhao20;printf("请输入查询的日期");gets(chazhao);struct list *p = Inhead;while(p != NULL)if(strc

21、mp(p->info.riqi,chazhao)=0)printf("姓名:");puts(p->); printf("日期:");puts(p->info.riqi); printf("收入:");printf("%.4fn",p->info.money); printf("备注:");puts(p->info.beizhu);system("PAUSE");p = p->next;if(Inhead!=NULL)cha

22、r panduan; printf("是否继续查询(Y/N)"); panduan=getchar();fflush(stdin);if(panduan='Y'|panduan='y')chaxun_income();void riqi_zhichu()char chazhao20;printf("请输入查询的日期");gets(chazhao);struct list *p = zhichuhead;while(p != NULL)if(strcmp(p->info.riqi,chazhao)=0)printf(&

23、quot;姓名:");puts(p->); printf("日期:");puts(p->info.riqi); printf("支出:");printf("%.4fn",p->info.money); printf("备注:");puts(p->info.beizhu);system("PAUSE");p = p->next;if(zhichuhead!=NULL)char panduan; printf("是否继续查询(Y/N

24、)"); panduan=getchar();fflush(stdin);if(panduan='Y'|panduan='y')chaxun_zhichu();void riqi_xiugai_income()char xiugai20;printf("请输入修改的日期");fflush(stdin);gets(xiugai);struct list *p = Inhead;while(p != NULL)if(strcmp(p->info.riqi,xiugai)=0) fflush(stdin);printf("

25、姓名:");gets(p->);fflush(stdin); printf("日期:");gets(p->info.riqi);fflush(stdin); printf("收入: ");scanf("%f",&p->info.money);fflush(stdin); printf("备注:");gets(p->info.beizhu);fflush(stdin); p = p->next;Save_income();if(Inhead!=NULL

26、)char panduan; printf("是否继续修改(Y/N)"); panduan=getchar();fflush(stdin);if(panduan='Y'|panduan='y')xiugai_income();void riqi_xiugai_zhichu()char xiugai20;printf("请输入修改的日期");fflush(stdin);gets(xiugai);struct list *p = zhichuhead;while(p != NULL)if(strcmp(p->info.r

27、iqi,xiugai)=0) fflush(stdin);printf("姓名:");gets(p->);fflush(stdin); printf("日期:");gets(p->info.riqi);fflush(stdin); printf("支出: ");scanf("%f",&p->info.money);fflush(stdin); printf("备注:");gets(p->info.beizhu);fflush(stdin); p

28、= p->next;Save_zhichu(); if(zhichuhead!=NULL)char panduan; printf("是否继续修改(Y/N)"); panduan=getchar();fflush(stdin);if(panduan='Y'|panduan='y')xiugai_zhichu();void money () /收入 float chazhao;printf("请输入查询的money");scanf("%f",&chazhao);fflush(stdin);s

29、truct list *p = Inhead;while(p != NULL)if(p->info.money=chazhao)printf("姓名:");puts(p->); printf("日期:");puts(p->info.riqi); printf("收入:");printf("%.4fn",p->info.money); printf("备注:");puts(p->info.beizhu);system("PAUSE"

30、;);p = p->next;if(Inhead!=NULL)char panduan; printf("是否继续查询(Y/N)"); panduan=getchar();fflush(stdin);if(panduan='Y'|panduan='y')chaxun_income();void money_zhichu ()float chazhao;printf("请输入查询的money");scanf("%f",&chazhao);fflush(stdin);struct list *

31、p = zhichuhead;while(p != NULL)if(p->info.money=chazhao)printf("姓名:");puts(p->); printf("日期:");puts(p->info.riqi); printf("收入:");printf("%.4fn",p->info.money); printf("备注:");puts(p->info.beizhu);system("PAUSE");p = p

32、->next;if(zhichuhead!=NULL)char panduan; printf("是否继续查询(Y/N)"); panduan=getchar();fflush(stdin);if(panduan='Y'|panduan='y')chaxun_zhichu();void money_xiugai_income()float xiugai;printf("请输入修改的money");scanf("%f",&xiugai);fflush(stdin);struct list *

33、p = Inhead;while(p != NULL)if(p->info.money=xiugai) fflush(stdin);printf("姓名:");gets(p->);fflush(stdin); printf("日期:");gets(p->info.riqi);fflush(stdin); printf("收入: ");scanf("%f",&p->info.money);fflush(stdin); printf("备注:");g

34、ets(p->info.beizhu);fflush(stdin); p = p->next;Save_income();if(Inhead!=NULL)char panduan; printf("是否继续修改(Y/N)"); panduan=getchar();fflush(stdin);if(panduan='Y'|panduan='y')xiugai_income();void money_xiugai_zhichu()float xiugai;printf("请输入修改的money");scanf(&q

35、uot;%f",&xiugai);fflush(stdin);struct list *p = zhichuhead;while(p != NULL)if(p->info.money=xiugai) fflush(stdin);printf("姓名:");gets(p->);fflush(stdin); printf("日期:");gets(p->info.riqi);fflush(stdin); printf("支出: ");scanf("%f",&p

36、->info.money);fflush(stdin); printf("备注:");gets(p->info.beizhu);fflush(stdin); p = p->next;Save_zhichu();if(zhichuhead!=NULL)char panduan; printf("是否继续修改(Y/N)"); panduan=getchar();fflush(stdin);if(panduan='Y'|panduan='y')xiugai_zhichu();void beizhu()char

37、chazhao20;printf("请输入查询的备注");gets(chazhao);struct list *p = Inhead;while(p != NULL)if(strcmp(p->info.beizhu,chazhao)=0)printf("姓名:");puts(p->); printf("日期:");puts(p->info.riqi); printf("收入:");printf("%.4fn",p->info.money); printf

38、("备注:");puts(p->info.beizhu);system("PAUSE");p = p->next;if(Inhead!=NULL)char panduan; printf("是否继续查询(Y/N)"); panduan=getchar();fflush(stdin);if(panduan='Y'|panduan='y')chaxun_income();void beizhu_zhichu()char chazhao20;printf("请输入查询的备注")

39、;gets(chazhao);struct list *p = zhichuhead;while(p != NULL)if(strcmp(p->info.beizhu,chazhao)=0)printf("姓名:");puts(p->); printf("日期:");puts(p->info.riqi); printf("收入:");printf("%.4fn",p->info.money); printf("备注:");puts(p->info.

40、beizhu);system("PAUSE");p = p->next;if(zhichuhead!=NULL)char panduan; printf("是否继续查询(Y/N)"); panduan=getchar();fflush(stdin);if(panduan='Y'|panduan='y')chaxun_zhichu();void beizhu_xiugai_income()char xiugai20;printf("请输入修改的备注");fflush(stdin);gets(xiug

41、ai);struct list *p = Inhead;while(p != NULL)if(strcmp(p->info.beizhu,xiugai)=0) fflush(stdin);printf("姓名:");gets(p->);fflush(stdin); printf("日期:");gets(p->info.riqi);fflush(stdin); printf("支出: ");scanf("%f",&p->info.money);fflush(stdin

42、); printf("备注:");gets(p->info.beizhu);fflush(stdin); p = p->next;Save_income();if(Inhead!=NULL)char panduan; printf("是否继续修改(Y/N)"); panduan=getchar();fflush(stdin);if(panduan='Y'|panduan='y')xiugai_income();void beizhu_xiugai_zhichu() char xiugai20;printf(&q

43、uot;请输入修改的备注");fflush(stdin); gets(xiugai);fflush(stdin);struct list *p = zhichuhead;while(p != NULL)if(strcmp(p->info.beizhu,xiugai)=0) fflush(stdin);printf("姓名:");gets(p->);fflush(stdin); printf("日期:");gets(p->info.riqi);fflush(stdin); printf("支出: &q

44、uot;);scanf("%f",&p->info.money);fflush(stdin); printf("备注:");gets(p->info.beizhu);fflush(stdin); p = p->next;Save_zhichu();if(zhichuhead!=NULL)char panduan; printf("是否继续修改(Y/N)"); panduan=getchar();fflush(stdin);if(panduan='Y'|panduan='y')x

45、iugai_zhichu();void Income_menu() /收入菜单 system("cls");printf("=n");printf("#欢迎使用家庭财务小管家#n");printf("=n"); printf("1.添加收入n"); printf("2.删除收入n"); printf("3.查询收入n"); printf("4.显示收入n"); printf("5.修改收入n"); printf(&q

46、uot;0.返回上一级n"); void zhichu_menu() /支出菜单 system("cls");printf("=n");printf("#欢迎使用家庭财务小管家#n");printf("=n"); printf("1.添加支出n"); printf("2.删除支出n"); printf("3.查询支出n"); printf("4.显示支出n"); printf("5.修改支出n"); pri

47、ntf("0.返回上一级n"); void chaxun_menu() /查询菜单 system("cls");printf("=n");printf("#欢迎使用家庭财务小管家#n");printf("=n");printf("1.按名字查询n");printf("2.按日期查询n");printf("3.按money询n");printf("4.按备注查询n");printf("0.返回上一级n&quo

48、t;);void xiugai_menu() system("cls");printf("=n");printf("#欢迎使用家庭财务小管家#n");printf("=n");printf("1.按名字修改n");printf("2.按日期修改n");printf("3.按money修改n");printf("4.按备注修改n");printf("0.返回上一级n");void Add_income() char p

49、anduan; dotemp=(struct list*)malloc(sizeof(struct list);printf("姓名");gets(temp->);fflush(stdin);printf("日期");gets(temp->info.riqi);fflush(stdin);printf("收入");scanf("%f",&temp->info.money);fflush(stdin);printf("备注");gets(temp->

50、;info.beizhu);fflush(stdin);printf("n");temp->next=NULL; if(Inhead = NULL)Inhead = temp;Intail = temp;elseIntail->next = temp;Intail = temp; Save_income(); printf("是否(Y/N)继续添加信息n"); panduan=getchar();fflush(stdin); while(panduan='Y'|panduan='y'); system(&quo

51、t;PAUSE");void Add_zhichu() char panduan; dotemp=(struct list*)malloc(sizeof(struct list);printf("姓名");gets(temp->);fflush(stdin);printf("日期");gets(temp->info.riqi);fflush(stdin);printf("支出");scanf("%f",&temp->info.money);fflush(stdi

52、n);printf("备注");gets(temp->info.beizhu);fflush(stdin);printf("n");temp->next=NULL; if(zhichuhead = NULL)zhichuhead = temp;zhichutail = temp;elsezhichutail->next = temp;zhichutail = temp; Save_zhichu(); printf("是否(Y/N)继续添加信息n"); panduan=getchar();fflush(stdin);

53、while(panduan='Y'|panduan='y'); system("PAUSE");void Del_income() char shanchu20;struct list *p=NULL;struct list *m =NULL;struct list *n =NULL;p=Inhead;printf("请输入删除姓名");gets(shanchu);if(strcmp(Inhead->,shanchu)=0)while(Inhead!=NULL && strcmp(I

54、nhead->,shanchu)=0)char ch;printf("找到一个数据名字为%s,确认删除Y/N?",shanchu);ch=getchar();fflush(stdin);if(ch='y'|ch='Y')Inhead=Inhead->next;else break;elseif(strcmp(Intail->,shanchu)=0) do m=p; p=p->next; while(p!=Intail); m->next=NULL;elsedo m=p; p=p->next; n=p->next; while(strcmp(p->,shanchu)!=0&&n->next!=NULL); if(strcmp(p->,shanchu)=0) m->next=n; Save_income(); if(Inhead!=NULL)char panduan; printf("是否继续删除(Y/N)"); panduan=getchar();

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论