资源描述:
《c语言个人收入支出系统》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、#include"stdio.h"#include"windows.h"#include"stdlib.h"#include"conio.h"#include"iostream.h"#definepe"%2d%8d%6d%9d%10d%11d%8d%7d%8d"structCheckbook{intmon;intincome;intfood;inthouse;inteducation;intwat_ele;inttreat;intsave;intout;Checkbook*next;};int
2、count=0;intflag=0;Checkbook*Head,*Total;voidinit_Head(){Head=newCheckbook;Head=NULL;}voidinit_Total(){Total=newCheckbook;Total->income=0;Total->food=0;Total->house=0;Total->education=0;Total->wat_ele=0;Total->treat=0;Total->save=0;Total->out=0;}voidTO
3、TAL(Checkbook*h){Checkbook*p=h;while(p!=NULL){p->out=p->food+p->house+p->education+p->wat_ele+p->treat;Total->income=Total->income+p->income;Total->food=Total->food+p->food;Total->house=Total->house+p->house;Total->education=Total->education+p->educat
4、ion;Total->wat_ele=Total->wat_ele+p->wat_ele;Total->treat=Total->treat+p->treat;Total->save=Total->save+p->save;Total->out=Total->out+p->out;p=p->next;}}intinsert(){Checkbook*p,*q;inti;intch;while(1){system("cls");for(i=0;i<15;i++)printf("*");printf("
5、记录每月收支情况");for(i=0;i<15;i++)printf("*");p=newCheckbook;printf("请输入:");printf("月份收入食品消费房租子女教育费用水电费医疗费储蓄");cin>>p->mon>>p->income>>p->food>>p->house>>p->education>>p->wat_ele>>p->treat>>p->save;count++;if(flag==0){if(count==1)Head=p;elseq->nex
6、t=p;q=p;}if(flag==1){q=Head;while(q->next!=NULL)q=q->next;q->next=p;q=p;}q->next=NULL;printf("ttt1继续请按1,返回请按0!");scanf("%d",&ch);getchar();if(ch==0){flag=1;init_Total();TOTAL(Head);return0;}}}Display(Checkbook*p){Checkbook*q=p;inti;sys
7、tem("cls");for(i=0;i<15;i++)printf("*");printf("每月收支状况");for(i=0;i<15;i++)printf("*");printf("月份收入食品消费房租子女教育费用水电费医疗费储蓄支出");while(q!=NULL){printf(pe,q->mon,q->income,q->food,q->house,q->education,q->wat_ele,q->treat,q->save,q->out);q=q->next;}p
8、rintf("合计:%5d%6d%9d%10d%11d%8d%7d%8d",Total->income,Total->food,Total->house,Total->education,Total->wat_ele,Total->treat,Total->save,Total->out);printf("ttt1请按0返回!");getchar();getchar();return1;}Checkbook*q[12];selectsort_1(Ch