Exp7 2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

EXP7_2 #include<iostream.h> #include<conio.

h> class acc { char name[22],type[10]; long no,bal,dbal,wbal; public: acc() { bal=100000; } void accept() { cout<<"\nEnter your name"; cin>>name; cout<<"\nEnter your account no"; cin>>no; cout<<"\nEnter your type"; cin>>type; } void deposit() { cout<<"\nEnter the amount to be deposited"; cin>>dbal; bal=dbal+bal; } void withdraw() { cout<<"\nEnter the amount to withdraw"; cin>>wbal; bal=bal-wbal; } void display() { cout<<"\nName:"<<name; cout<<"\nUpdated Balance:"<<bal; } }; void main() { int i; clrscr(); acc a; a.accept(); cout<<"\nEnter 1 to deposit"; cout<<"\nEnter 2 to withdraw;"; cin>>i; if(i==1) { a.deposit(); a.display(); } else if(i==2) { a. withdraw(); a.display(); } else { a.display(); } getch(); } Page 1

Print to PDF without this message by purchasing novaPDF (http://www.novapdf.com/)

You might also like