Write a C++ Program for Bank
#include
#include
class account
{
char cust_name[20];
int acc_no;
char acc_type[20];
public:
void get_accinfo()
{
cout<<"\n\nEnter Customer Name :- "; cin>>cust_name;
cout<<"Enter Account Number :- "; cin>>acc_no;
cout<<"Enter Account Type :- "; cin>>acc_type;
}
void display_accinfo()
{
cout<<"\n\nCustomer Name :- "<
balance = balance + deposit;
}
void withdraw_currbal()
{
float penalty,withdraw;
cout<<"\n\nBalance :- "<
balance=balance-withdraw;
if(balance < penalty="(500-balance)/10;" balance="balance-penalty;" else="" withdraw=""> balance)
{
cout<<"\n\nYou have to take permission for Bank Overdraft Facility\n"; balance=balance+withdraw; } else cout<<"\nAfter Withdrawl your Balance revels : "<
savbal = savbal + deposit;
interest=(savbal*2)/100;
savbal=savbal+interest;
}
void withdraw_savbal()
{
float withdraw;
cout<<"\nBalance :- "<
savbal=savbal-withdraw;
if(withdraw > savbal)
{
cout<<"\n\nYou have to take permission for Bank Overdraft Facility\n"; savbal=savbal+withdraw; } else cout<<"\nAfter Withdrawl your Balance revels : "<
int choice;
if(type=='s' || type=='S')
{
s1.get_accinfo();
while(1)
{
clrscr();
cout<<"\nChoose Your Choice\n"; cout<<"1) Deposit\n"; cout<<"2) Withdraw\n"; cout<<"3) Display Balance\n"; cout<<"4) Display with full Details\n"; cout<<"5) Exit\n"; cout<<"6) Choose Your choice:-"; cin>>choice;
switch(choice)
{
case 1 : s1.deposit_savbal();
getch();
break;
case 2 : s1.withdraw_savbal();
getch();
break;
case 3 : s1.disp_savbal();
getch();
break;
case 4 : s1.display_accinfo();
s1.disp_savbal();
getch();
break;
case 5 : goto end;
default: cout<<"\n\nEntered choice is invalid,\"TRY AGAIN\""; } } } else { { c1.get_accinfo(); while(1) { cout<<"\nChoose Your Choice\n"; cout<<"1) Deposit\n"; cout<<"2) Withdraw\n"; cout<<"3) Display Balance\n"; cout<<"4) Display with full Details\n"; cout<<"5) Exit\n"; cout<<"6) Choose Your choice:-"; cin>>choice;
switch(choice)
{
case 1 : c1.deposit_currbal();
getch();
break;
case 2 : c1.withdraw_currbal();
getch();
break;
case 3 : c1.disp_currbal();
getch();
break;
case 4 : c1.display_accinfo();
c1.disp_currbal();
getch();
break;
case 5 : goto end;
default: cout<<"\n\nEntered choice is invalid,\"TRY AGAIN\"";
}
}
}
end:
}
}