forked from thakursaurabh1998/cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bank.cpp
52 lines (48 loc) · 991 Bytes
/
bank.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
#include<iostream>
#include<cstring>
using namespace std;
class Account
{
long account_no;
char name[50];
float balance;
public:
void assign(char* nm, float bln, long ac)
{
account_no = ac;
strcpy(name,nm);
balance = bln;
}
void disp()
{
cout<<"Name: " << name << endl;
cout<<"Account No: " << account_no << endl;
cout << "Balance: " << balance << endl;
}
void deposit(float cred)
{
balance+=cred;
cout<< "Balance Updated"<< endl;
}
};
int main()
{
Account cust1;
char name[50];
float balance;
float credit;
long account;
cout << "Enter name: " ;
cin >> name;
cout << "Enter balance: ";
cin >> balance;
cout << "Enter account number: ";
cin >> account;
cust1.assign(name,balance,account);
cust1.disp();
cout << "Enter amount to deposit: ";
cin >> credit;
cust1.deposit(credit);
cust1.disp();
return 0;
}