C++ Program-Bank Operation

C++ Program-Bank Operation

6 10 99
C++ Program-Bank Operation 10 6 99


#include<iostream.h>
#include<conio.h>
class bank
{
char name[20];
char type;
int bamt,acno;
public:
void initial();
void deposite();
void withdraw();
void display();
};
void bank::initial()
{
cout<<"enter your name\n";
cin>>name;
cout<<"enter your type of account\n";
cout<<"s for saving\n";
cout<<"c for current\n";
cin>>type;
cout<<"enter account number\n";
cin>>acno;
cout<<"enter initial amount\n";
cin>>bamt;
if(bamt<200)
{
cout<<"minimum amount is 200\n";
cout<<"enter the amount\n";
cin>>bamt;
}
}
void bank::deposite()
{
int dep;
cout<<"enter the amount to be deposited\n";
cin>>dep;
bamt=bamt+dep;
}
void bank::withdraw()
{
int wdraw;
cout<<"enter the amount to be withdrawed\n";
cin>>wdraw;
if(bamt-wdraw<200)
cout<<"withdrawing is not possible\n";
else
bamt=bamt-wdraw;
}
void bank::display()
{
cout<<"NAME\t\tAC-TYPE\t\tAC_NO\t\tBALANCE\t\t\n";
cout<<name<<"\t\t"<<type<<"\t\t"<<acno<<"\t\t"<<bamt<<"\t\t\n";
}
void main()
{
bank b1;
clrscr();
char ch;
cout<<"do you wish to open an account(y/n)\n";
cin>>ch;
if(ch=='y'||ch=='Y')
{
do
{
b1.initial();
do
{
cout<<"enter your choice\n";
cout<<"1.deposite\n";
cout<<"2.withdraw\n";
cout<<"3.display\n";
cin>>ch;
switch(ch)
{
case'1':b1.deposite();
break;
case'2':b1.withdraw();
break;
case'3':b1.display();
break;
default:cout<<"invalid choice\n";
break;
}
cout<<"do you want to make any operation as the same a/c\n";
cin>>ch;
}
while(ch=='y'||ch=='Y');
cout<<"for new customer press(y/n)\n";
cin>>ch;
}
while(ch=='y'||ch=='Y');
}
getch();
}








output:


do you wish to open an account(y/n)
y
enter your name
niya
enter your type of account
s for saving
c for current
s
enter account number
12
enter initial amount
1000
enter your choice
1.deposite
2.withdraw
3.display
1
enter the amount to be deposited
500
do you want to make any operation as the same a/c



y
enter your choice
1.deposite
2.withdraw
3.display
2
enter the amount to be withdrawed
400
do you want to make any operation as the same a/c
y
enter your choice
1.deposite
2.withdraw
3.display
3
NAME            AC-TYPE         AC_NO           BALANCE
niya            s               12              1100
do you want to make any operation as the same a/c

n

0 comments:

Post a Comment

 
HowTo © 2015 | HowTo | Design By HowZto | HOWTO
Top