BANK-3

 

#include <iostream>

using namespace std;

void menu();

void showbalance();

void drawmoney();

void deposit();

void transfermoney();

void change();

int password=92851;

int main()
{
	
	
	int j, i = 1;
	
	cout<< "********************************" << endl
		
		<< "* WELCOME TO SHINIGAMI BANK *" << endl
		
		<< "********************************" << endl
		
		<< " " << endl
		
		<< " " << endl
		
		<< " " << endl
		
		<<" 请输入密码:";
	
	for(i = 1; i <= 2; i++)
	{
		
		cin >> j;
		
		if(j == password)
		{ 
			menu();
			
			exit(0);
		}
		else
			
			cout << "密码错误,请重新输入:";
	}
	
	
	cin >> j;
	
	if (j == password)
		
		menu();
	
	else
		
		cout << "您输入密码错误次数已满三次,请到营业厅查询密码后再来。谢谢合作!" << endl;
	
	exit(0); 
	
	return 0;
}


void menu()
{
	int x;
	
	char ch;
	
	while(1)
	{
		cout << " "<<endl
			
			<< " 1.查询" << endl
			
			<< " 2.取款" << endl
			
			<< " 3.存款" << endl
			
			<< " 4.转账" << endl
			
			<< " 5.修改密码" << endl
			
			<< " 0,退出" << endl
			
			<< " " << endl
			
			<< " 请输入选择的项目:";
		
		cin >> x;
		
		switch(x)
		{
		case 1: showbalance(); break;
			
		case 2: drawmoney(); break;
			
		case 3: deposit(); break;
			
		case 4: transfermoney(); break;
			
		case 5: change(); break;
			
		case 0: cout << " 谢谢,欢迎下次使用!\n"; break;
			
		default: cout << " 输错,不要急\n"; break;
		}
		
		cout << "按N退出,任意键继续" << endl;
		
		getchar();
		
		ch = getchar();
		
		if(ch == 'n' || ch == 'N')
			
			exit(0);
	}
}


void showbalance()
{
	cout << "\n 您的余额为100000000元.\n";
}
void drawmoney()
{
	int y, z;
	
	double a, x, day;
	
	cout << "\n 请输入您要提取的金额:";
	
	cin >> x;
	
	cout << "\n 1.活期\n"
		
		<< " 2.定期\n"
		
		<< "\n 请输入您的存期:";
	
	cin >> y;
	
	if(y == 1)
	{
		cout << "\n 请输入存入的天数:" ;
		
		cin >> day;
		
		a = x * 0.0050 * (day / 360);
	}
	else
	{
		cout << "\n 1.3个月 \n"
			
			<< " 2.6个月 \n"
			
			<< " 3.一年 \n"
			
			<< " 4.二年 \n"
			
			<< " 5.三年 \n"
			
			<< " 6.五年\n"
			
			<< "\n 请输入您的存期:";
		
		cin >> z;
		
		if (z >= 1 && z <= 6)
		{
			switch(z)
			{
				
			case 1: a = x * 0.0310 * 0.25; break;
				
			case 2: a = x * 0.0330 * 0.5; break;
				
			case 3: a = x * 0.0350; break;
				
			case 4: a = x * 0.0440 * 2; break;
				
			case 5: a = x * 0.0500 * 3; break;
				
			case 6: a = x * 0.0550 * 5; break;
			}
		}
		
		else
			
			cout << "\n 你的输入有误,请重新输入:" << endl;
	} 
	cout << "\n 您的利息为:" << a <<endl
		
		<< "*******************************************************" << endl;
	
}
void deposit()
{
	int b, z;
	
	double a;
	
	cout << "\n 请输入存入的钱数:"
		
		<< " ";
	
	cin >> a;
	
	cout << "\n 1.活期\n"
		
		<< " 2.定期\n" 
		
		<< "\n 请选择:";
	
	cin >> b;
	
	if(b == 2)
	{
		cout << "\n 1.3个月 \n"
			
			<< " 2.6个月 \n"
			
			<< " 3.一年 \n"
			
			<< " 4.二年 \n"
			
			<< " 5.三年 \n"
			
			<< " 6.五年\n"
			
			<< "\n 请输入您的存期:";
		
		cin >> z;
	} 
	
	cout << "\n 存款成功!\n"
		
		<< "************************************\n";
}

void transfermoney()
{
	int b;
	
	double a;
	
	cout << "\n 请输入转存的账户:";
	
	cin >> b;
	
	cout << "\n 请输入转存的金额:";
	
	cin >> a;
	
	cout << "\n 转存成功!\n"
		
		<< "**********************************\n";
}

void change()
{
	int x, y, j;
	
	cout << "\n 请输入原始密码:";
	
	while (1)
	{
		cin >> j;
		
		if(j == password)
		{ 
			cout << "\n 请输入新密码:";
			
			cin >> x;
			
			cout << "\n 确认密码:"; 
			
			while (1)
			{
				cin >> y;
				
				if(y == x)
				{
					cout << "\n 密码修改成功!\n";
					
					password = x;
					
					break;
				}
				else
				{
					cout << "密码错误,请重新输入:";
				}
			}
		}
		else
		{
			cout << "\n 密码错误,请重新输入:";
			
			continue;
		}
		break;
	}
	cout << "\n**********************************\n" ;
}






 

 

时隔将近一个月的时间,一直困在输入三次密码错误退出上···

先这样吧,有空再改···


评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值