# Include <iostream>
Using namespace std;
Int main ()
{
Bool codes ();
Void work ();
Cout <"Welcome to ATM" <endl;
Cout <"Enter the six-digit password :";
If (codes ())
Work ();
Else
Cout <"sorry, your password is incorrectly entered three times, and your card has been locked. Please take the relevant creden to the business office to unlock" <endl;
Return 0;
}
Bool codes ()
{
Bool code = false;
Int mima, num = 1;
Do
{
If (num> 1)
Cout <"(note: this is the" <num <"password. If the password is incorrect three times, your card will be locked !) "<Endl <" enter the password again :";
Cin> mima;
Num ++;
If (mima = 654321)
Code = true;
}
While (! Code & num <= 3 );
Return code;
}
Void work ()
{
Char choice;
Bool exit = false;
Do
{
Void showbalance ();
Void drawmoney ();
Void deposit ();
Void transferAccounts ();
Cout <endl <"* you can handle the following services:" <endl;
Cout <"* 1. Query" <endl;
Cout <"* 2. Withdrawal" <endl;
Cout <"* 3. Deposit" <endl;
Cout <"* 4. Transfer" <endl;
Cout <"* 0. Exit" <endl;
Cout <"* enter (0-4 ):";
Cin> choice;
Switch (choice)
{
Case '1 ':
Showbalance ();
Break;
Case '2 ':
Drawmoney ();
Break;
Case '3 ':
Deposit ();
Break;
Case '4 ':
TransferAccounts ();
Break;
Case '0 ':
Cout <"welcome to use it again! "<Endl;
Exit = true;
}
} While (! Exit );
Return;
}
Void showbalance ()
{
Cout <"your balance is ***" <endl;
}
Void drawmoney ()
{
Double money;
Cout <"Enter the withdrawal amount :";
Cin> money;
Cout <"sorry, your balance is insufficient! ";
}
Void deposit ()
{
Int type, days;
Double moneys, period, rate, interest;
Cout <"Enter the deposit amount :";
Cin> moneys;
Cout <"===== deposit term ====" <endl;
Cout <"1. Current Account" <endl;
Cout <"2. 3 months" <endl;
Cout <"3. 6 months" <endl;
Cout <"4. One year" <endl;
Cout <"5. 2 years" <endl;
Cout <"6. Three years" <endl;
Cout <"7. 5 years" <endl;
Cout <"Enter the deposit term Code :";
Cin> type;
If (type> = 1 & type <= 7)
{
Switch (type)
{
Case 1:
Cout <"Enter the number of days for deposit :";
Cin> days;
Period = days/360.0;
Rate = 0.005;
Break;
Case 2:
Period = 0.25;
Rate = 0.031;
Break;
Case 3:
Period = 0.5;
Rate = 0.033;
Break;
Case 4:
Period = 1;
Rate = 0.035;
Break;
Case 5:
Period = 2;
Rate = 0.044;
Break;
Case 6:
Period = 3;
Rate = 0.05;
Break;
Case 7:
Period = 5;
Rate = 0.055;
Break;
}
Interest = moneys * period * rate;
Cout <"Expiration interest:" <interest <"Yuan, total principal and interest" <interest + moneys <"Yuan. "<Endl;
}
Else
Cout <"Incorrect deposit type selection! "<Endl;
Cout <"Thank you for your use. Welcome to the next visit! "<Endl;
}
Void transferAccounts ()
{
Long int number;
Int money;
Cout <"Enter the transfer card number :";
Cin> number;
Cout <"Enter the transfer amount :";
Cin> money;
Cout <"sorry, your balance is insufficient! "<Endl;
}