




免费预览已结束,剩余1页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
# include # include class accountprivate: int id; char * name; double balance;public: account(); account(int,const char * ,double); void saving(); int withdraw(); void showme(); int getid();class bankprivate: account * account50; int maxid; int accnum;public: bank(); void append(); void delete(); void query();account:account()id = 0;strcpy(name, );balance = 0;account:account(int id,const char * name,double balance)id = id;name = new char50;strcpy(name,name);balance = balance;void account:saving()double number;coutnumber;balance = balance + number;coutnow the balance of your account is balanceendl;return;int account:withdraw()double number;coutnumber;if(balancenumber) coutsorry,now the balance of your accout is less than number.so you can not withdraw!endl; return 0;balance = balance - number;coutnow the balance of your account isbalanceendl;return 1;void account:showme()coutaccount id:idendl;coutname:nameendl;coutbalance:balanceendl;return;int account:getid()return id;bank:bank()for(int i=0;i50;i+) accounti = null;maxid = 0;accnum = 0;void bank:append()if(accnum = 50) coutsorry,the bank is full,so can not add new account!endl; return;int id;char * name = new char50;double balance;coutname;id = maxid;balance = 0;account * acc = new account(id,name,balance);accountaccnum = acc;coutappend successful!endlshowme();maxid+;accnum+;return;void bank:delete()int id;coutid;int flag = 1;int i = 0;while(igetid() /flag = 0 indicate had found the accountid flag = 0; else i+; if(flag) coutthe account does not exists!endlendl; return; for(int j=i;jaccnum;j+) accountj = accountj+1;delete accountaccnum-1;accnum-;coutdelete successful!endlendl;return;void bank:query()int id;coutid;int flag = 1;int i=0;while(igetid() flag = 0; else i+; if(flag) coutthe account does not exist!endlshowme();int choice =0;while(choice!=3) cout 1:save moneyendl; cout 2:withdraw moneyendl; cout 3:returnendl; coutchoice; coutsaving(); break; case 2: accounti-withdraw(); break; case 3: break; return;void main()bank bank;int choice = 0;coutwelcome to bank systemendl;while(choice != 4) cout1: add an accountendl; cout2: delete an accountendl; cout3: query an accountendl; cout4: exitendlendl; coutplease input your choice:; coutchoice; switch(choice) ca
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 电脑配件装机知识培训课件
- 电脑设备基础知识培训课件
- 高考文言文句式课件
- 配网基建工作前期补偿协议
- sas考试题目及答案
- plm系统考试及答案
- 电线电缆课件
- 福建省龙岩市长汀县2022-2023学年九年级上学期期中化学试题(含答案)
- 电站运维培训课件
- 电磁继电器课件
- 学校食堂从业人员食品安全知识培训考试试题(含答案)
- 2025年教科版新教材科学三年级上册全册教案设计(含教学计划)
- 医院药品采购与质量控制规范
- 支部纪检委员课件
- 从+“心”+出发遇见更好的自己-开学第一课暨心理健康教育主题班会-2025-2026学年高中主题班会
- 枣庄学院《图学基础与计算机绘图》2024-2025学年第一学期期末试卷
- GB 46031-2025可燃粉尘工艺系统防爆技术规范
- 初中历史教师培训讲座
- 2025年苏教版新教材数学二年级上册教学计划(含进度表)
- T/CCS 075-2023煤矿柔性薄喷材料喷涂施工技术要求
- 近十年中职试卷及答案
评论
0/150
提交评论