个人理财管理系统代码
2014-11-20 22:22
281 查看
#include <algorithm> #include <iostream> #include <windows.h>//调用 #include <cstring> #include <cstdlib> #include <cstdio> #include <iomanip> #include <fstream> #include <time.h> #include <cctype> #include <map> #include <set> //一大批头文件 using namespace std; class Time //时间类 { //基类的私有成员定义 private: int month; int day; int year; //基类的公用成员定义 public: void GetTime(int y,int m,int d)//此函数用来获取时间的年月日 { year=y; month=m; day=d; } void CheckTime();//此函数用来检查时间的年月日 } Time1;//声明一个对象Time1 void Time::CheckTime() //时间错误检查 { //判断输入是否符合要求 //用if --else 简单语句进行判断 if(month>12 ||month<1) { MessageBox(NULL,"月份输入错误","错误!",MB_OK); exit(0); } else { if(month==1||month==3 ||month==5||month==7||month==8||month==10||month==12)//宋政在此调试,时间2014/11/15,考虑月份不周全,进行完善 { if(day>31 || day<1) { MessageBox(NULL,"日期输入错误","错误!",MB_OK); exit(0); } } else { if(month==4||month==6 ||month==9||month==11)//郑志成在此调试,时间2014/11/15,考虑月份不周全,进行完善 if(day<1||day>30) { MessageBox(NULL,"日期输入错误","错误!",MB_OK); exit(0); } } } if(month==2) if(day>29||day<1) { MessageBox(NULL,"日期输入错误","错误!",MB_OK); exit(0); } } //定义Time类的派生类CFinnance,派生方式的公用派生 typedef class CFinance:public Time { //定义派生类的公用成员,也就是在基类的基础上新增加的成员 public: int year,month,day;//定义年月日 double Income,Output;//定义收入和支出的变量 CFinance *next;//定义一个指针变量 } Infor; void SearchIncomeInfor(Infor *head);//查询收入的函数 void SearchOutputInfor(Infor *head);//查询支出的函数 int menu_select();//菜单的选择函数 void SearchDateInfor(Infor *head);//查找日期的函数 //首先创建一个空链表进行存储 Infor *Inforinitlist() //创建信息空链表 { Infor *head; head=(Infor*)malloc(sizeof(Infor)); head->next =NULL; return head; } int menu_select() { char *m[6]= {"1.录入财务信息","2.浏览财务信息","3.查询财务信息","4.统计财务信息", "5.退出财务系统" }; char *c; c=new char[50]; do { system("cls");//系统清屏 cout<<"\t\t----------财务管理系统总菜单----------------"<<endl<<endl; for(int i=0; i<5; i++) cout<<"\t\t\t"<<m[i]<<endl<<endl; cout<<"请用户做出选择:"<<endl; cout<<"Choice"<<endl; cin>>c; } while(c[0]<'1'||c[0]>'5'||c[1]); return(c[0]-'0'); } void InputFinanceInfor(Infor *head) { system("cls");//系统清屏 cout<<"\t\t------------------输入财务信息---------------------"<<endl<<endl; Infor *p1,*p2,*p3; p3=head; if(NULL!=p3->next) { p3=p3->next; } p2=p3; char input,*in; in=&input; do { p1=(Infor*)malloc(sizeof(Infor)); cout<<"\t\t\t年份整形变量[int]: "; cin>>p1->year; cout<<endl<<"\t\t\t月份整形变量[int]: "; cin>>p1->month; cout<<endl<<"\t\t\t日期整形变量[int]: "; cin>>p1->day; cout<<endl<<"\t\t\t收入浮点型变量[double]: "; cin>>p1->Income; cout<<endl<<"\t\t\t支出浮点型变量[double]: "; cin>>p1->Output; p2->next=p1; p2=p1; cout<<endl<<"\t是否继续输入?(Yes/No)"; cin>>*in; system("pause");//调用系统函数,按任意键继续程序 } while(toupper(input)!='No'); p2->next=NULL; } void ListFinanceInfor(Infor *head) { Infor *p; p=head->next; if(p!=NULL) { system("cls");//系统清屏 cout<<endl<<"\t\t==========浏览全部财务信息=========="<<endl; while(p!=NULL) { cout<<"\t\t-------------------------------------------"<<endl<<endl; cout<<setw(8)<<"\t\t年:"<<p->year<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"\t\t月:"<<p->month<<endl; cout<<setw(8)<<"\t\t日: "<<p->day<<endl;//sewt()是定义字段长度的函数 cout<<"\t\t收入情况:"<<p->Income<<endl; cout<<"\t\t支出情况:"<<p->Output<<endl; cout<<"\t\t=================================="<<endl; p=p->next; } } } //查询总菜单 void SearchMenu(Infor *head) { Infor *p; p=head->next; int ch; system("cls");//系统清屏 cout<<endl<<"**********财务查询**********"<<endl<<endl; cout<<"=========1.支出查询========="<<endl<<endl; cout<<"=========2.收入查询========="<<endl<<endl; cout<<"=========3.日期查询========="<<endl<<endl; cout<<"=========4.返回上层========="<<endl<<endl; cout<<"****************************"<<endl<<endl; cout<<"请用户做出选择:"<<endl; cout<<"Option:"; cin>>ch; switch (ch) { case 1: SearchOutputInfor(p); system("pause");//调用系统函数,按任意键继续程序 break; case 2: SearchIncomeInfor(p); system("pause");//调用系统函数,按任意键继续程序 break; case 3: SearchDateInfor(p); system("pause");//调用系统函数,按任意键继续程序 break; case 4: system("cls");//系统清屏 return; default: break; } } void SearchOutputInfor(Infor *head) { Infor *p; p=head; system("cls");//系统清屏 cout<<endl<<endl<<"\t\t====================支出查询==============="<<endl; while(p!=NULL) { if(0!=p->Output) { cout<<setw(8)<<"年:"<<p->year<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"月:"<<p->month<<endl; cout<<setw(8)<<"日:"<<p->day<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"支出:"<<p->Output<<endl; cout<<"\t\t ---------------------------------------"<<endl; } p=p->next; } } void SearchIncomeInfor(Infor *head) { Infor *p; p=head; system("cls");//系统清屏 cout<<endl<<endl<<"\t\t====================收入查询==============="<<endl; while(p!=NULL) { if(0!=p->Output) { cout<<setw(8)<<"年:"<<p->year<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"月:"<<p->month<<endl; cout<<setw(8)<<"日:"<<p->day<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"收入:"<<p->Income<<endl;//sewt()是定义字段长度的函数 cout<<"\t\t ---------------------------------------"<<endl; } p=p->next; } } void SearchDateInfor(Infor *head) { int x,y,z; Infor *p; p=head; cout<<"请输入日期。"<<endl; cin>>x>>y>>z; Time1.GetTime(x,y,z); Time1.CheckTime(); cout<<endl<<endl<<"\t\t====================日期查询==============="<<endl; while(x!=p->year||y!=p->month||z!=p->day) { if(p->next ==NULL) { cout<<"未找到记录!"<<endl; cout<<"\t\t----------------------------------------"<<endl; return; } p=p->next; } system("cls");//系统清屏 cout<<setw(8)<<"年:"<<p->year<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"月:"<<p->month<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"日:"<<p->day<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"收入:"<<p->Income<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"支出:"<<p->Output<<endl;//sewt()是定义字段长度的函数 cout<<"\t\t ---------------------------------------"<<endl; } void CalculateMonthInfor(Infor *head) { int x,y; Infor *p; p=head; system("cls");//系统清屏 cout<<endl<<endl<<"\t\t====================按月统计==============="<<endl; cout<<"输入年份,月份!"<<endl; cin>>x>>y; while(p!=NULL) { if(x==p->year&&y==p->month) { cout<<setw(8)<<"年:"<<p->year<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"月:"<<p->month<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"日:"<<p->day<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"支出:"<<p->Output<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"收入:"<<p->Income<<endl;//sewt()是定义字段长度的函数 cout<<"\t\t ---------------------------------------"<<endl; } p=p->next; } } void CalculateYearInfor (Infor *head) { int x; Infor *p; p=head; system("cls");//系统清屏 cout<<endl<<endl<<"\t\t====================按年统计==============="<<endl; cout<<"输入年份!"<<endl; cin>>x; while(p!=NULL) { if(x==p->year) { cout<<setw(8)<<"年:"<<p->year<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"月:"<<p->month<<endl; cout<<setw(8)<<"日:"<<p->day<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"支出:"<<p->Output<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"收入:"<<p->Income<<endl;//sewt()是定义字段长度的函数 cout<<"\t\t ---------------------------------------"<<endl; } p=p->next; } } void CalculateDayInfor (Infor *head) { int x,y,z; Infor *p; p=head; system("cls");//系统清屏 cout<<endl<<endl<<"\t\t====================按日统计==============="<<endl; cout<<"输入年份,月份,日期!"<<endl; cin>>x>>y>>z; while(p!=NULL) { if(x==p->year&&y==p->month&&z==p->day) { cout<<setw(8)<<"年:"<<p->year<<endl;//sewt()是定义字段长度的函数 cout<<setw(8)<<"月:"<<p->month<<endl; cout<<setw(8)<<"日:"<<p->day<<endl; cout<<setw(8)<<"支出:"<<p->Output<<endl; cout<<setw(8)<<"收入:"<<p->Income<<endl;//sewt()是定义字段长度的函数 cout<<"\t\t ---------------------------------------"<<endl; } p=p->next; } } //宋政,贾超负责调试,时间2014/11/15针对清屏功能 void CalculateInfor(Infor *head) { Infor *p; p=head->next; int ch; system("cls");//系统清屏 cout<<endl<<"**********财务统计**********"<<endl<<endl;//李烁界面创建,时间2014/11/13,进行基本输出语句的使用和完善界面的美化外包 cout<<"=========1.按年统计========="<<endl<<endl; cout<<"=========2.按月统计========="<<endl<<endl; cout<<"=========3.按日统计========="<<endl<<endl; cout<<"=========4.返回上层========="<<endl<<endl; cout<<"****************************"<<endl<<endl; cout<<"Option:"; cin>>ch; switch (ch) { case 1: CalculateYearInfor(p); system("pause");//调用系统函数,按任意键继续程序 break; case 2: CalculateMonthInfor(p); system("pause");//调用系统函数,按任意键继续程序 break; case 3: CalculateDayInfor(p); system("pause");//调用系统函数,按任意键继续程序 break; case 4: system("cls");//系统清屏 return; default: break; } } int main() { Infor *st,*head=NULL; system("color 1D");//调用系统的界面颜色函数 st=Inforinitlist(); int choice=0; while(choice!=6) { choice=menu_select(); switch(choice) { case 1: InputFinanceInfor(st); system("pause");//调用系统函数,按任意键继续程序 break; case 2: ListFinanceInfor(st); system("pause");//调用系统函数,按任意键继续程序 case 3: SearchMenu(st); system("pause");//调用系统函数,按任意键继续程序 break; case 4: CalculateInfor(st); system("pause");//调用系统函数,按任意键继续程序 break; case 5: exit(0); break; default: ; } } return 0; } //刘继国负责创建主要核心代码。时间2014/11/20日进行最终完善
相关文章推荐
- Java web项目 个人资金项目管理系统用户部分代码
- 善用分布式版本管理系统管理个人代码
- Java web项目 个人资金项目管理系统管理员部分代码
- 个人理财帐户管理系统C语言源码
- 想工作室个人信息管理系统
- 常用系统管理代码
- 开源: 个人财务管理系统文档与源码下载
- 开源: 个人财务管理系统文档与源码下载
- [源码发布]个人知识库管理系统
- 星光topsales客户管理系统 v1.0 个人版 绿色
- 网络应用系统---系统设计架构个人项目实战示例(各种页面代码A)
- 九酷网络个人主页空间管理系统3.0漏洞查找实例
- TroyKM个人知识管理系统---开发进度
- 针式个人知识管理系统帮助:实现您的PKM梦想!
- 针式个人知识管理系统帮助:实现您的PKM梦想!
- 一个学生成绩管理系统的代码
- 王笑媚的毕业设计课题--个人文献管理系统
- 开发个人财务管理系统(一)建数据库
- 个人管理系统
- 针式个人知识库管理系统V3.62版帮助目录