为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

c++银行存取款账户管理

2017-11-16 11页 doc 27KB 39阅读

用户头像

is_686908

暂无简介

举报
c++银行存取款账户管理c++银行存取款账户管理 #include 2 #include 3 4 using namespace std; 5 6 class Account 7 { 8 public: 9 Account(string a,string b,double bal); 10 virtual void saving(double a); 11 virtual void withdrow(double a); 12 virtual void showme(); 13 string getId(); 14 ...
c++银行存取款账户管理
c++银行存取款账户管理 #include 2 #include 3 4 using namespace std; 5 6 class Account 7 { 8 public: 9 Account(string a,string b,double bal); 10 virtual void saving(double a); 11 virtual void withdrow(double a); 12 virtual void showme(); 13 string getId(); 14 15 16 private: 17 string Account_name; 18 string name; 19 double balance ; 20 21 22 }; 23 24 class NormalAccount:public Account 25 { 26 public: 27 NormalAccount(string a,string b,double bal):Account(a,b,bal) 28 { 29 30 } 31 private: 32 string Account_name; 33 string name; 34 double balance ; 35 }; 36 37 class VIPAccount:public Account 38 { 39 public: 40 VIPAccount(string a,string b,double bal,double d,double e):Account(a,b,bal),tzsx(d),tzze(e) 41 { 42 43 } 44 void withdrow(double a); 45 void showme(); 46 47 48 private: 49 string Account_name; 50 string name; 51 double balance ; 52 double tzsx; 53 double tzze; 54 55 56 }; 57 58 Account::Account(string a,string b,double bal) 59 { 60 Account_name = a; 61 name = b; 62 balance = bal; 63 } 64 65 void Account::saving(double a) 66 { 67 balance = balance + a; 68 } 69 70 void Account::withdrow(double a) 71 { 72 if(a > balance) 73 cout<<"余额不足"<balance + tzsx -tzze) 96 cout<<"不可透支"<>str1; 144 cout << "请输入开户人姓名" << endl; 145 cin>>str2; 146 Account *acc = new NormalAccount(str1,str2,0) ; 147 cout<<"增加普通账户成功"<>str1; 159 cout << "请输入开户人姓名" << endl; 160 cin>>str2; 161 Account *acc = new VIPAccount(str1,str2,0,5000,0) ; 162 cout<<"增加高级账户成功"<>n; 173 174 for(int i=0;i<100;i++) 175 { 176 if(account[i]->getId() != n) 177 cout<<"没有这个账号"<getId() == n) 179 { 180 delete account[i]; 181 accNum--; 182 183 } 184 185 } 186 } 187 188 void Bank::query() 189 { 190 string n; 191 cout << "请输入您要查询的用户账号" << endl; 192 cin>>n; 193 194 for(int i=0;i<100;i++) 195 { 196 if(account[i]->getId() != n) 197 cout<<"没有这个账号"<getId() == n) 199 account[i]->showme(); 200 } 201 202 } 203 204 int main() 205 { 206 Bank bank; 207 208 while(1) 209 { 210 cout << "1.增加账户" << endl; 211 cout << "2.删除账户" <>n; 221 222 if(n == 1) 223 { 224 int n; 225 cout << "1.增加普通账户" << endl; 226 cout << "2.增加高级账户" << endl; 227 cout << "请选择" << endl; 228 cin>>n; 229 230 if(n == 1) 231 bank.append1(); 232 233 if(n == 2) 234 bank.append2(); 235 236 } 237 238 if (n == 2) 239 { 240 bank.del(); 241 } 242 243 if (n == 3) 244 { 245 bank.query(); 246 } 247 248 if (n == 4) 249 { 250 251 string n; 252 cout<<"请输入您要存取款的账号"<>n; 254 for(int i=0;i<100;i++) 255 { 256 if(bank.account[i]->getId() != n) 257 cout<<"账号输入错误"<getId() == n) 259 { 260 int choice; 261 262 cout<<"1.取款"<>choice; 267 if(choice == 1) 268 { 269 double jine; 270 cout<<"请输入取款金额"<> jine; 272 bank.account[i]->withdrow(jine); 273 bank.account[i]->showme(); 274 275 } 276 if(choice == 2) 277 { 278 double qkuan; 279 cout<<"请输入存款金额"<>qkuan; 281 bank.account[i]->saving(qkuan); 282 bank.account[i]->showme(); 283 } 284 } 285 286 } 287 288 289 } 290 291 if (n == 5) 292 return 0; 293 } 294 295 //return 0; 296 }
/
本文档为【c++银行存取款账户管理】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索