-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
89 lines (68 loc) · 2.22 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include<iostream>
#include "./message.h"
using namespace std;
int main(){
int mainPin = 1234;
long double balance = 10000.30;
long double deposit = 0;
long double withdraw = 0;
int inputPin;
bool isRunning = true;
int count = 0;
int option;
while(isRunning){
if(inputPin != mainPin){
//Call Welcome Message
welcomeMessage();
cin >> inputPin;
if(inputPin != mainPin){
count++;
cout << "Incorrect PIN"<<endl;
}
if(count >= 3){
cout << "Account Locked"<<endl;
isRunning = !isRunning;
}
}else{
welcomeMessage(true);
cin >> option;
switch(option){
case 1:
cout << "Amount To Deposit"<<endl;
cin >> deposit;
if(!deposit){
cout << "Input Amount Must Be Bigger Than 0"<<endl;
break;
}
balance += deposit;
cout << "You Deposited N"<<deposit<<" Successfully"<<endl;
break;
case 2:
cout << "Amount To Withdraw"<<endl;
cin >> withdraw;
if(!withdraw){
cout << "Withdraw Amount Must Be Bigger Than 0";
break;
}
if(balance >= withdraw) {
balance -= withdraw;
cout << "You Withdraw N"<<withdraw<<" Successfully"<<endl;
}
else cout << "Insufficient Balance"<<endl;
break;
case 3:
cout << "| ------------------------------ |" <<endl;
cout << " Your Balance Is N" <<balance<<endl;
cout << "| ------------------------------ |" <<endl;
break;
case 4:
cout<<"Thanks For Banking With Us";
isRunning = !isRunning;
break;
default:
cout << "Invalid Option"<<endl;
}
}
}
return 0;
}