Advertisement
Sufyan

Programe 1

Sep 5th, 2011
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.14 KB | None | 0 0
  1. //write a C++ programe..
  2. #include<iostream.h>
  3. #include<conio.h>
  4. #include<string.h>
  5. class bank
  6. {
  7.     int accno;
  8.     char name[50],typeacc[10];
  9.     float amount,balance;
  10.     public:
  11.  
  12.     bank()
  13.     {
  14.         accno = 0;
  15.         amount = 0.0;
  16.         balance = 0.0;
  17.         strcpy(name,"10");
  18.         strcpy(typeacc,"10");
  19.  
  20.     }
  21.     void read()
  22.     {
  23.     cout<<"Enter Acc No:";
  24.     cin>>accno;
  25.     cout<<"Enter Name:";
  26.     cin>>name;
  27.  
  28.     cout<<"Enter Account Type( Saving, Current , F.D):";
  29.     cin>>typeacc;
  30.  
  31.     cout<<"Enter Basic Balance:";
  32.     cin>>balance;
  33.  
  34. }
  35.     void deposit()
  36.     {
  37.  
  38.     cout<<"Enter the Amount to deposit:";
  39.     cin>>amount;
  40.  
  41.     balance = balance+amount;
  42.     }
  43.     void withdraw()
  44.     {
  45.  
  46.     cout<<"Enter the Amount to Withdraw:";
  47.     cin>>amount;
  48.  
  49.     if(amount<=balance)
  50.         balance=balance-amount;
  51.     else
  52.         cout<<"Not Enough Balance to Withdraw";
  53.     }
  54.     void print()
  55.     {
  56.  
  57.     cout<<"\n The Account No is:"<<accno;
  58.     cout<<"\n The Account Type is:"<<typeacc;
  59.     cout<<"\n The Account Name is:"<<name;
  60.     cout<<"\n The Account Balance is:"<<balance;
  61.     }
  62.      };
  63.      void main()
  64.      {
  65.      clrscr();
  66.      bank b;
  67.      b.read();
  68.      b.deposit();
  69.      b.withdraw();
  70.      b.print();
  71.      getch();
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement