- #include<iostream>
- using namespace std;
- static long int id;
- class bank{
- protected:
- char name[10];
- double money=2000;
- int acc_no;
- public:
- void setdetails(){
- cout<<"\n Enter name :";
- cin>>name;
- cout<<"\nyour acc_no(PLEASE NOTE DOWN) : "<<id;
- acc_no=id;
- id++;
- cout<<"\n you have to deposite '2000rs' for opening account in pruthvi bank\n THANK YOU";
- cout<<"\nPlease keep balance above 2000rs";
- }
- };
- class deposite:virtual public bank{
- public:
- void set_deposit(){
- float temp;
- cout<<"\n Enter deposite value : ";
- cin>>temp;
- money=money+temp;
- cout<<"\n Now money : "<<money<<endl;
- }
- };
- class withdrawl:virtual public bank{
- public:
- void set_with(){
- float temp;
-
- cout<<"\n Enter withdrawl value : ";
- cin>>temp;
- if((money-temp)>2000){
- money=money-temp;
- }
- else {
- cout<<"\nyou cant withdrawl";
- }
- cout<<"\n Now money : "<<money<<endl;
- }
- };
- class child:public deposite,public withdrawl{
- public:
- void printd(){
- cout<<"\n your name : "<<name<<"\n your account no : "<<acc_no<<"\n money="<<money;
- }
- };
-
- int main(){
- child p[100];
- char ch;
- long i;
- int choice;
- do{
- label:
- cout<<"\n1.create account\n2.deposite\n3.withdrawl\n4.details\n choice : ";
- cin>>choice;
- switch(choice){
- case 1:p[id].setdetails();break;
- case 2:
- cout<<"Enter id : ";cin>>i;
- p[i].set_deposit();
- break;
- case 3:
- cout<<"Enter id : ";cin>>i;
- p[i].set_with();
- break;
- case 4:
- cout<<"Enter id : ";cin>>i;
- p[i].printd();
- break;
- default:
- goto label;
- }
- }
- while(1);
- return 0;
- }
-
Comments
Post a Comment