|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 (^__^)个个 于 2012-12-4 17:00 编辑
小型学生理财系统 序号 11
满足学生个人的理财需求,提供账户管理,收支管理,统计等功能。
基本要求:
1. 账户管理
2. 收支分类设置
3. 收入管理
4. 支出管理
5. 必须要用面向对象设计思想编程实现
高级要求:
1、界面友好;
2、对账户信息进行统计(例如某单位时间内收支分类排序等);
3、数据信息能保存在文件中,并能从文件中读取出来。
1、11周星期一至星期五:
选题、交分组名单和课程设计题目;收集资料、需求分析;强化数据结构、面向对象等知识;系统设计;
2.、12周星期一至13周星期三:
程序设计,汇报演示(星期三);
3.、13周星期五:
提交课程设计报告。
这学期刚学的C++和数据结构,课程设计中求各位帮帮忙……
现在主要是想要增加查找和删除功能,从文件中可以查找到想要的日期的账单纪录、、和可以删除想要删除的纪录……
licai.rar
(1.26 KB, 下载次数: 8)
这个是我写的代码、、
#include<iostream>#include<fstream>#include<string>using namespace std;
class ZhangDan{public: virtual void time(); virtual void shouru(); virtual void zhichu(); virtual void chakan(); virtual void qingkong(); ZhangDan() { cout<<"****欢迎使用小型学生理财系统****"<<endl; } ~ZhangDan() { cout<<"****感谢使用小型学生理财系统****"<<endl; }
private: int a,b,sum,sum1,sum2; int time_moon,time_day; };
void ZhangDan::time(){ cout<<"请输入月份:"<<endl; cin>>time_moon; cout<<"请输入日期"<<endl; cin>>time_day; cout<<time_moon<<"月"<<time_day<<"日"<<endl;}
void ZhangDan::shouru(){ sum1=0; int xuanze; while(xuanze) { cout<<"¥¥¥¥¥请选择您的收入类型¥¥¥¥"<<endl; cout<<"**********1 生活费 2 兼职*********"<<endl; cout<<"**********3 奖学金 4 其他*********"<<endl; cout<<"**********5 收入统计 0 返回*********"<<endl; cout<<"¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥"<<endl; cout<<"请输入您要进行的操作序号:"<<endl; cin>>xuanze; if(xuanze<0||xuanze>5) { cout<<"您输入的操作序号有误!!"<<endl; cout<<"请重新输入!!"<<endl; } switch(xuanze) { case 1: { cout<<"请输入金额:"<<endl; cin>>a; sum1+=a; ofstream outfile("zhangdan.txt",ios::app); if(!outfile) { cout<<"文件打开失败!!"<<endl; } outfile<<time_moon<<"月"<<time_day<<"日:"<<" "<<"收入(生活费):"<<a<<" ¥_¥ "<<endl; outfile.close(); break; } case 2: { cout<<"请输入收入金额:"<<endl; cin>>a; sum1+=a; ofstream outfile("zhangdan.txt",ios::app); if(!outfile) { cout<<"文件打开失败!!"<<endl; } outfile<<time_moon<<"月"<<time_day<<"日:"<<" "<<"收入(兼职):"<<a<<" ¥_¥ "<<endl; outfile.close(); break; } case 3: { cout<<"请输入收入金额:"<<endl; cin>>a; sum1+=a; ofstream outfile("zhangdan.txt",ios::app); if(!outfile) { cout<<"文件打开失败!!"<<endl; } outfile<<time_moon<<"月"<<time_day<<"日:"<<" "<<"收入(奖学金):"<<a<<" ¥_¥ "<<endl; outfile.close(); break; } case 4: { cout<<"请输入收入金额:"<<endl; cin>>a; sum1+=a; ofstream outfile("zhangdan.txt",ios::app); if(!outfile) { cout<<"文件打开失败!!"<<endl; } outfile<<time_moon<<"月"<<time_day<<"日:"<<" "<<"收入(其他):"<<a<<" ¥_¥ "<<endl; outfile.close(); break; } case 5: { ofstream outfile("zhangdan.txt",ios::app); if(!outfile) { cout<<"文件打开失败!!"<<endl; } outfile<<time_moon<<"月"<<time_day<<"日:"<<" "<<"收入总额:"<<sum1<<" ¥_¥ "<<endl; cout<<"统计结果已写入文件中,请返回主界面查看。。"<<endl; outfile.close(); break; } } } }void ZhangDan::zhichu(){ int xuanze; sum2=0; while(xuanze) { cout<<"$$$$$$$$$请选择您的支出类型$$$$$$$$$$$$$$"<<endl; cout<<"********1 饮食费用 2 交通费用********"<<endl; cout<<"********3 生活必需品 4 其他************"<<endl; cout<<"********5 支出统计 0 返回*************"<<endl; cout<<"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$"<<endl; cout<<"请输入您要进行的操作序号:"<<endl; cin>>xuanze; if(xuanze<0||xuanze>5) { cout<<"您输入的操作序号有误!!"<<endl; cout<<"请重新输入!!"<<endl; } switch(xuanze) { case 1: { cout<<"请输入支出费用:"<<endl; cin>>b; sum2-=b; ofstream outfile("zhangdan.txt",ios::app); if(!outfile) { cout<<"文件打开失败!!"<<endl; } outfile<<time_moon<<"月"<<time_day<<"日:"<<" "<<"支出(饮食):"<<b<<" $_$ "<<endl; outfile.close(); break; } case 2: { cout<<"请输入支出费用:"<<endl; cin>>b; sum2-=b; ofstream outfile("zhangdan.txt",ios::app); if(!outfile) { cout<<"文件打开失败!!"<<endl; } outfile<<time_moon<<"月"<<time_day<<"日:"<<" "<<"支出(交通):"<<b<<" $_$ "<<endl; outfile.close(); break; } case 3: { cout<<"请输入支出费用:"<<endl; cin>>b; sum2-=b; ofstream outfile("zhangdan.txt",ios::app); if(!outfile) { cout<<"文件打开失败!!"<<endl; } outfile<<time_moon<<"月"<<time_day<<"日:"<<" "<<"支出(必需):"<<b<<" $_$ "<<endl; outfile.close(); break; } case 4: { cout<<"请输入支出费用:"<<endl; cin>>b; sum2-=b; ofstream outfile("zhangdan.txt",ios::app); if(!outfile) { cout<<"文件打开失败!!"<<endl; } outfile<<time_moon<<"月"<<time_day<<"日:"<<" "<<"支出(其他):"<<b<<" $_$ "<<endl; outfile.close(); break; } case 5: { ofstream outfile("zhangdan.txt",ios::app); if(!outfile) { cout<<"文件打开失败!!"<<endl; } outfile<<time_moon<<"月"<<time_day<<"日:"<<" "<<"支出总额:"<<sum2<<" $_$ "<<endl; cout<<"统计结果已写入文件中,请返回主界面查看。。"<<endl; outfile.close(); break; } } }}void ZhangDan::chakan(){ string c; ifstream infile("zhangdan.txt"); if(!infile) { cout<<"文件打开失败!!"<<endl; } while(infile>>c) { cout<<c; if(c='_') cout<<endl; } cout<<endl; infile.close(); sum=sum1+sum2; cout<<"您所剩余额为:"<<sum<<endl;
}void ZhangDan::qingkong(){ ofstream outfile("zhangdan.txt",ios::trunc); if(!outfile) { cout<<"清空失败!!"<<endl; } else { cout<<"已清空。。"<<endl; } outfile.close();}
int main(){ int xuanze; ZhangDan zd; zd.time(); while(1) { cout<<"********************************"<<endl; cout<<"********************************"<<endl; cout<<"********1 收入 2 支出*********"<<endl; cout<<"********3 查看 4 清空*********"<<endl; cout<<"************0 退出**************"<<endl; cout<<"********************************"<<endl; cout<<"********************************"<<endl; cout<<"请输入您要进行的操作序号:"<<endl; cin>>xuanze; if(xuanze<0||xuanze>4) { cout<<"您输入的操作序号有误!!"<<endl; cout<<"请重新输入!!"<<endl; } switch(xuanze) { case 1: zd.shouru(); break; case 2: zd.zhichu(); break; case 3: zd.chakan(); break; case 4: zd.qingkong(); break; case 0: zd.~ZhangDan(); exit(1); } } return 0;}
|
|