鱼C论坛

 找回密码
 立即注册
查看: 3882|回复: 8

大二学生课程设计求助、、

[复制链接]
发表于 2012-12-4 16:54:33 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

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;}



小甲鱼最新课程 -> https://ilovefishc.com
 楼主| 发表于 2012-12-4 17:02:06 | 显示全部楼层
自己先顶一个……望好心人帮帮忙……
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-12-4 17:22:27 | 显示全部楼层
你看下自己是不是将文件的操作那块的知识理解的不是很好!
小甲鱼最新课程 -> https://ilovefishc.com
 楼主| 发表于 2012-12-4 17:28:20 | 显示全部楼层
小甲鱼最新课程 -> https://ilovefishc.com
 楼主| 发表于 2012-12-4 17:29:06 | 显示全部楼层
Su_In_Lee 发表于 2012-12-4 17:22
你看下自己是不是将文件的操作那块的知识理解的不是很好!

应该如何从文件中查找信息呢?
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-12-4 20:06:05 | 显示全部楼层
还以为有数据库呢。。
小甲鱼最新课程 -> https://ilovefishc.com
 楼主| 发表于 2012-12-4 20:20:46 | 显示全部楼层
衣冠者禽兽也 发表于 2012-12-4 20:06
还以为有数据库呢。。

下学期学……哎,对于文件这块还是不太行、、
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2012-12-4 20:56:54 | 显示全部楼层
要有数据库吧
小甲鱼最新课程 -> https://ilovefishc.com
 楼主| 发表于 2012-12-7 16:47:31 | 显示全部楼层

:lol弄完了……谢谢了
小甲鱼最新课程 -> https://ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-11-16 17:06

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表