-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankSystem.cpp
More file actions
134 lines (130 loc) · 2.87 KB
/
Copy pathBankSystem.cpp
File metadata and controls
134 lines (130 loc) · 2.87 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#include <iostream>
using namespace std;
int pin = 4567;
int total = 0;
int balance = 0;
int record = 1;
void deposit()
{
long double a ;
cout<<"Amount want to deposit : "<<endl;
cin>>a;
cout<<"You have been deposited : "<<a<<"$"<<endl;
total = a;
balance += total;
}
void checkbalance()
{
cout<<"Total balance = "<<total+balance<<endl;
total = balance;
}
void withdrawn()
{
int d;
long double b;
cout<<"Enter amount to be withdrawn : ";
cin>>b;
if(b > total)
cout<<"Insufficient amount .."<<endl;
if(b <= total)
{
cout<<"you have been withdrwan : "<<b<<"$"<<endl;
d = total - b;
cout<<"Remaining : "<<d<<"$"<<endl;
}
}
void accounts()
{
if(record == 1)
{
while (true)
{
int option;
cout<<"1-open account."<<endl;
cout<<"2-set the current account."<<endl;
cout<<"3-delete account."<<endl;
cout<<"Enter option : ";
cin>>option;
long double number;
string name;
int code;
cin.ignore();
if(option == 1)
{
cout<<"Your name for account : ";
getline(cin,name);
cout<<"Enter your number for account : ";
cin>>number;
cout<<"Enter pin of account security: ";
cin>>code;
cin.ignore();
cout<<"name : "<<name<<endl;
cout<<"Number : "<<number<<endl;
cout<<"Pin : "<<code<<endl;
pin = code;
}
if(option == 2)
{
cout<<"Prevoius details : "<<endl;
cout<<"name : "<<name<<endl;
cout<<"Number : "<<number<<endl;
cout<<"Pin : "<<code<<endl;
cout<<"Enter new data .. "<<endl;
cout<<"Your name for account : ";
getline(cin,name);
cout<<"Enter your number for account : ";
cin>>number;
cout<<"Enter pin of account security: ";
cin>>code;
cin.ignore();
cout<<"name : "<<name<<endl;
cout<<"Number : "<<number<<endl;
cout<<"Pin : "<<code<<endl;
pin = code;
}
if(option == 3)
{
record == 0;
cout<<"del account ...."<<endl;
}
if(option == 0)
{
break;
}
}
}
}
int main()
{
while(true)
{
cout<<"1-Deposit ."<<endl;
cout<<"2-Withdraw."<<endl;
cout<<"3-check balance."<<endl;
cout<<"4-account creation."<<endl;
cout<<"5-Exit."<<endl;
int choice ;
cout<<"Enter choice (1-5): ";
cin>>choice;
switch(choice)
{
case 1 :
deposit();
break;
case 2 :
withdrawn();
break;
case 3 :
checkbalance();
break;
case 4 :
accounts();
break;
case 5 :
exit(0);
break;
default :
cout<<"Invalid ..."<<endl;
}
}
}