银行管理系统-C++课程设计.docx_第1页
银行管理系统-C++课程设计.docx_第2页
银行管理系统-C++课程设计.docx_第3页
银行管理系统-C++课程设计.docx_第4页
银行管理系统-C++课程设计.docx_第5页
已阅读5页,还剩7页未读 继续免费阅读

下载本文档

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

文档简介

c+课程设计一、 课程设计要求课 程面向对象技术与c+ 班级130605-606、609-610、612指导教师姜虹题 目银行账户管理完成时间13-14学年第(2)学期第18周/第19周主要内容1问题描述设计一个银行账户管理程序,账户的信息有账号(唯一)、姓名、余额、身份证号码、单位、电话号码、地址等,允许用户进行如下操作:开户、销户、存款、取款、转账、查询,一个用户可以有多个户头,账户的数值没有上限。2基本要求程序运行时,可以由用户选择进行何种操作,开户操作要求输入用户信息后自动获取账号,用户销户后账号被回收,并且该账号可以继续分配给其它账户,不允许用户透支,根据姓名或账号可以进行用户的信息查询,所有的账户信息应存放到一个文件中,可以随时的访问和更新。3测试数据程序应输入不少于10人的账户信息,应考虑到人员同名的情况。设计报告要求1封面:(格式附后)2课程设计任务书3课程设计报告: 系统总体方案 设计思路和主要步骤 各功能模块和流程图 设计代码 心得体会和参考资料说明:学生完成课程设计后,提交课程设计报告及软件,要求文字通畅、字迹工整(也可用以打印),文字不少于5000 字,并装订成册。版面要求1.题目用黑体三号,段后距18磅(或1行),居中对齐;2标题用黑体四号,段前、段后距6磅(或0.3行);3.正文用小四号宋体,行距为1.25倍行距;4.标题按“一”、“”、“1”、“”顺序编号。上机时间安排星期周次一二三四五六日第2周1-41-41-41-41-4指导时间地点上机时间,e506二、源程序代码:#include#include#include#include#include#include#includeusing namespace std;class function;class userpublic: void get(user& );friend class function; ostream &print(ostream &os);/friend ostream & operator(istream & i, user & u);void password();bool login(user &);void savefile(user &); vector strfunction;user()user(int a,string n,int f,string i,string ad,int t):accout(a),name(n),fmoney(f),id(i),address(ad),telephone(t) int accout; string name; int fmoney; string id; string address; int telephone; char pword19; char pword29;class functionpublic: void saving(user &);void drawing(user &);void balance(user &);void record(user &);private:int saveanddrawmoney;void function:saving(user &u) system(cls); coutnnntt*nendl; coutsaveanddrawmoney; u.fmoney+=saveanddrawmoney; strstream ss; string str2;ssstr2; string frist=record+str2 +.txt; const char *recordfile=frist.c_str(); ofstream outfile(recordfile,ios:out|ios:app); outfilestr1saveanddrawmoneyendl; outfile.close(); outfile.clear(); coutnntt操作成功,单击任何键返回主菜单!; getch();void function:drawing(user &u) system(cls); coutnnntt*nendl; couttt请输入取款金额:; string str1(ntt现取rmb 钞- ); string str2; int k=0; while(ksaveanddrawmoney;u.fmoney -=saveanddrawmoney; if(u.fmoney=0) system(cls);coutnnntt正在出炒,请稍等!endl;strstream ss;ssstr2;string frist=record+str2 +.txt; const char *recordfile=frist.c_str(); ofstream outfile(recordfile,ios:out|ios:app); outfilestr1saveanddrawmoney=3) system(cls); cerrnnntt很抱歉,你重复输入错误多次endl ntt正在退卡中endl; exit(0); system(cls); u.fmoney +=saveanddrawmoney; cerrnnntt对不起,你输入的金额超出有效金额。endl ntt 请重新输入: ; coutnntt操作成功,单击任何键返回主菜单!; getch();void function:balance(user &u) system(cls); coutnnntt*nendl; couttt你当前的余额是:; coutttu.fmoneyendl; coutntt*nendl; coutntt操作成功,单击任何键返回主菜单!; getch();void function:record(user &u) string str1,str2;system(cls);coutnnntt*nendl;couttt摘要币种钞汇存/取款金额endl;strstream ss;ssstr2;string frist=record+str2 +.txt; const char *recordfile=frist.c_str();ifstream infile(recordfile,ios:in);if(!infile) coutntt没有任何历史记录!endl; getch(); return ;while(!infile.eof() getline (infile,str1); coutnttstr1endl;coutntt*nendl;coutntt操作成功,单击任何键返回主菜单!;getch();ostream &user:print(ostream &os) system(cls); osnnntt*nendl; osntt用户卡号:accoutendl; osntt姓名: name endl; osntt账户金额:fmoneyendl; osntt身份证号:idendl; osntt地址: address endl; osntt联系电话:telephone endl; osntt密码: pword1endl; osntt*nendl; coutntt操作成功,单击任何键返回主菜单!; getch(); return os;void user:savefile(user &u) int filename=u.accout; string frist; string last(.txt); strstream ss; ssfrist;frist+=last; const char *userid=frist.c_str();ofstream outfile(userid,ios:out |ios:trunc ); outfileaccout name fmoney id address telephone pword1endl; outfile.close();bool user:login(user &u) int acc; string pwd; coutntt登陆用户:endl; coutacc; coutpwd; int filename=acc; string frist; string last(.txt); strstream ss; ssfrist;frist+=last; const char *userid=frist.c_str();ifstream infile(userid,ios:in ); while (infile (*this) if (u.accout = acc ) string str; str=pword1;if(str= pwd) return true; return false;istream & operator(istream & i, user & u) iu.accout u.name u.fmoney u.id u.address u.telephone u.pword1 ; return i;void user:password() int num=0; while(num3) coutntt请输入位储蓄密码:; for(int i=0;i8;i+) pword1i=getch();cout*; pword18=0; coutendl; coutntt请再一次确认密码:; for( i=0;i8;i+) pword2i=getch();cout*; coutendl; pword28=0; if(strcmp(pword1,pword2)=0) coutnntt密码确认成功,单击任何键进入主菜单; getch(); return ; else num+; coutntt你输入的密码错误,请重新输入!nendl; if(num=3) system(cls); cerrnnntt对不起,你三次输入不正确nendl tt感谢你的使用,再见! endl; exit(0); void user:get(user& u)system(cls); coutnnntt请输入用户信息:nendl; couttt*nendl; coutaccout; coutname; coutfmoney; coutid; coutaddress; couttelephone; u.password(); coutntt*nendl;void sign()system(cls);coutnnnnnnttt谢谢您使用银行管理系统t nnendl;couttt*nendl;couttt 姓名: xxxxxnn tt 班级: xxxxxxxxxxnn tt 学号: xxxxxxxxnnendl; coutntt 已经成功退出endl ntt 欢迎你的光临! endl;char custom(user &u) char x;int k=0;system(cls);coutnnnttntt ntt 欢迎使用储蓄管理系统 ntt ntt 请用户在使用前选择开户: ntt ntt 请选择: ntt 1:注册开户 ntt 2:用户登录 ntt 其他:退出 ntt ntt nttnendl; coutx; if(x=1) u.get(u); else if(x=2) while(k3) if(u.login(u) /判断登陆是否成功 return 0; elsesystem(cls);cerrnnnttt输入有误!nendl ttt请重新输入:=3) system(cls); cerrnnntt对不起,你三次输入不正确nendl ntt感谢你的使用,再见!nendl; exit(0); else sign(); exit(0); return 0;char menu() int k=0; char a3,c,i;system(cls); coutnnntt 主菜单 nn ;couttt*ntt* *ntt* *ntt* 操作方式: *ntt* *ntt* 1.存款 2.取款 *ntt* *ntt* 3.查询余额 4.查询历史记录 *ntt* *ntt* 5.用户信息 6.保存并退出 *ntt*nendl;while(k3)couta;if(strlen(a)=1)for(i=1;i=6;i+) c=i;if(c=a0) return c;elsesystem(cls);cerrnnnttt输入有误!nendl ttt请重新输入:=3)system(cls); cerrnnntt对不起,你三次输入不正确nendl ntt感谢你的使用,再见!nendl; exit(0);return c;char choose( user &u,function &f) char c=menu(); while(c!=6) swit

温馨提示

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

评论

0/150

提交评论