CPP Programs. Banking Program
#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
class banking
{
public:
char name[25];
char type[30];
char number[20];
long int balance;
long int dep,with;
void create()
{
cout<<"\n\t\tEnter name: ";
cin>>name;
cout<<"\n\t\tEnter account type: ";
cin>>type;
cout<<"\n\t\tEnter account number: ";
cin>>number;
cout<<"\n\t\tInitial balance: ";
cin>>balance;
}
void deposit()
{
cout<<"\n\t\tEnter the amount to be deposited: ";
cin>>dep;
balance=balance+dep;
cout<<"\n\t\tCurrent balance: "<<balance;
}
void withdraw()
{
cout<<"\n\t\tEnter the amount to be withdrawn: ";
cin>>with;
balance=balance-with;
cout<<"\n\t\tCurrent Balance: "<<balance;
}
void display()
{
cout<<"\n\t\tName of the customer: "<<name;
cout<<endl;
cout<<"\n\t\tAccount Number: "<<number;
cout<<endl;
cout<<"\n\t\tType of account: "<<type;
cout<<endl;
cout<<"\n\t\tBalance: "<<balance;
}
};
void main()
{
banking ob;
int x;
clrscr();
do
{
cout<<endl;
cout<<"\n\n\n\t\t\tWelcome to State Bank Of India ";
cout<<"\n\n\t\t 1.Create a new account";
cout<<"\n\n\t\t 2.Deposit amount";
cout<<"\n\n\t\t 3.Withdraw amount";
cout<<"\n\n\t\t 4.Display";
cout<<"\n\n\t\t 5.Exit";
cout<<"\n\n\t\t Select your choice: ";
cin>>x;
switch(x)
{
case 1:ob.create();break;
case 2:ob.deposit();break;
case 3:ob.withdraw();break;
case 4:ob.display();break;
case 5:break;
default:cout<<"Enter any value b/w 1-5";
}
}while(x!=5);
}