主函数
Main.cpp:
#include "Bank.h"
#include <iostream>
using namespace std;
void welcome();
void login(Bank * bank);
void mainmenu(Bank * bank);
int main()
{
Bank * bank = new Bank();
welcome();
login(bank);
return 0;
}
void welcome() //欢迎界面
{
cout << " +--------------------------------------+" << endl;
cout << " | |" << endl;
cout << " | 欢迎使用储蓄综合业务平台 |" << endl;
cout << " | |" << endl;
cout << " +--------------------------------------+" << endl;
}
void mainmenu(Bank * bank)
{
int choice = -1;
do
{
cout << endl;
cout << " +---------------------------------+" << endl;
cout << " | 存款 请按 1 开户 请按 4 |" << endl;
cout << " | 取款 请按 2 销户 请按 5 |" << endl;
cout << " | 查询 请按 3 转账 请按 6 |" << endl;
cout << " | 退出 请按 0 |" << endl;
cout << " +---------------------------------+" << endl;
cout << "请输入您的选择:" << endl;
cin >> choice;
switch(choice)
{
case 0:
exit(0);
case 1:
bank->deposit();
break;
case 2:
bank->withdraw();
break;
case 3:
bank->find_account();
break;
case 4:
bank->open_account();
break;
case 5:
bank->close_account();
break;
case 6:
bank->tranfser();
break;
default:
cout << "无效选项!" << endl;
break;
}
}while(choice != 0);
}
void login(Bank * bank)
{
string admin_userName;
string admin_userpassWord;
for(int i = 0; i < 3; i++)
{
cout << "请输入您的用户名:" << endl;
cin >> admin_userName;
cout << "请输入您的密码:" << endl;
cin >> admin_userpassWord;
if((admin_userName == "admin" ) && (admin_userpassWord == "admin"))
{
mainmenu(bank);
}
else
{
if(i < 2)
{
cout << "用户名或密码输入错误,请重新输入!" << endl;
}
else
{
cout << "连续输错用户名或密码,退出系统!" << endl;
break;
}
}
}
}
上机感言:项目终于做完了