-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram 25 - Bank Account Management System.cpp
More file actions
74 lines (58 loc) · 1.26 KB
/
Copy pathProgram 25 - Bank Account Management System.cpp
File metadata and controls
74 lines (58 loc) · 1.26 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
#include <iostream>
using namespace std;
class Bank
{
private:
int accountNo;
char name[30];
float balance;
public:
void createAccount()
{
cout << "Enter Account Number: ";
cin >> accountNo;
cout << "Enter Account Holder Name: ";
cin >> name;
cout << "Enter Initial Balance: ";
cin >> balance;
}
void deposit()
{
float amount;
cout << "Enter Deposit Amount: ";
cin >> amount;
balance += amount;
cout << "Amount Deposited Successfully.\n";
}
void withdraw()
{
float amount;
cout << "Enter Withdrawal Amount: ";
cin >> amount;
if (amount <= balance)
{
balance -= amount;
cout << "Amount Withdrawn Successfully.\n";
}
else
{
cout << "Insufficient Balance.\n";
}
}
void display()
{
cout << "\n----- Account Details -----\n";
cout << "Account Number : " << accountNo << endl;
cout << "Account Holder : " << name << endl;
cout << "Current Balance: " << balance << endl;
}
};
int main()
{
Bank b;
b.createAccount();
b.deposit();
b.withdraw();
b.display();
return 0;
}