-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbank management.cpp
105 lines (95 loc) · 2.22 KB
/
bank management.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#include<iostream>
#include<conio.h>
#include<stdio.h>
using namespace std;
class bank
{ char name[100],add[100],y;
int balance;
public:
void open_account();
void deposite_money();
void withdraw_money();
void display_account();
};
void bank :: open_account()
{
cout<<"enter your full name :: ";
cin.ignore();
cin.getline(name,100);
cout<<"enter your addrass :: ";
cin.ignore();
cin.getline(add,100);
cout<<"what type of account you want to open saving (s) or current (c) :: ";
cin>>y;
cout<<"enter amount for deposite :: ";
cin>>balance;
cout<<"your account is created \n";
}
void bank :: deposite_money()
{
int a;
cout<<"enter how much you deposite :: ";
cin>>a;
balance+=a;
cout<<"total amount you deposite :: \t "<<balance;
}
void bank :: display_account()
{
cout<<"your full name :: \t"<<name;
cout<<"your address :: \t"<<add;
cout<<"type of account that you open :: \t"<<y;
cout<<"Amount you deposite :: \t"<<balance;
}
void bank :: withdraw_money()
{
float amount;
cout<<"\n withdraw :: ";
cout<<"enter amount to withdraw :: ";
cin>> amount;
balance-=amount;
cout<<"now total amount is left :: "<< balance;
}
int main(){
int ch, x;
bank obj;
do{
cout<<"1) Open Account \n";
cout<<"2) Deposite Money \n";
cout<<"3) Withdraw Money \n";
cout<<"4) Display Account \n";
cout<<"5) Exit \n";
cout<<"Select the option from above \n";
cin>>ch;
switch(ch){
case 1:
cout<<"1) open account \n";
obj.open_account();
break;
case 2:
cout<<"2) deposite money \n";
obj.deposite_money();
break;
case 3:
cout<<"3) withdraw money \n";
obj.withdraw_money();
break;
case 4:
cout<<"4) display money \n";
obj.deposite_money();
break;
case 5:
if(ch==5){
exit(1);
}
default:
cout<<"this is not exist try again \n";
}
cout<<"\n do you want to select next option then press :: y \n";
cout<<"if you want to exit then press :: N";
x=getch();
if(x=='n'|| x=='N')
exit(0);
} while(x=='y'|| x=='Y');
getch();
return 0;
}