Sunday, December 02, 2012

ATM machine in C++


#include  <iostream>
#include  <conio.h>
#include <stdlib.h>
using namespace std;
class Customer {    
   char name[20];
     int p,q;
    char city[20];  
   char v[10];
  int n;
  public:  
  Customer(int a) { p=a;        
        }    
  int getdata() {  
cout << "\nEnter your name: ";  
cin >> name;  
cout << "\nEnter your city: "; cin >> city;          
 cout << "\nEnter current account balance: "; cin >> p;
 cout << "\nEnter account type:"; cin>>v;
 cout << "\n Set your password: "; cin>>q;   }
  int deposit() {         int dep;    
 cout << "\nEnter amount to be deposited: ";  
cin >> dep;         p=p + dep;      }  
 int withdraw() {         int wdraw;    
  cout << "\nEnter amount to be withdrawn: ";
cin >> wdraw;         p=p - wdraw;      }  
int showdata() {    int n; cout << "\nEnter pasword: ";            cin >> n;   if (n==10)
{ cout<<"Name:Asim wadood";
cout<<"\nAccount Balance: Rs."<<p;
cout<<"\nAccount type: current";
cout << "\nCity: " <<"kohat";}
if (n==11)
{cout<<"name:ayaz haider";
cout<<"\nAccount Balance: Rs."<<p;
cout<<"\nAccount type: current";
cout << "\nCity: " << "kohat";}
if (n==12)
{ cout<<"name:Abid shah";
cout<<"\nAccount Balance: Rs."<<p;
cout<<"\nAccount type: fixed";
cout << "\nCity: " << "kohat";}
if (n==13)
{ cout<<"name:Abdul hameed";
cout<<"\nAccount Balance: Rs."<<p;
cout<<"\nAccount type: current";
cout << "\nCity: " << "kohat";}
if (n==q)
{cout << "\nEnter your name: "<<name;  
cout << "\nEnter your city: "<<city;          
 cout << "\nEnter current account balance: "<<p;
 cout << "\nEnter account type:"<<v;
   }
         
 }
  }; int main() {    char choice;   int z = 0;
     
 Customer cust(1000);    while (z == 0) {
          cout<<"\n*********WELCOME TO ASIM BANK ACCOUNT SYSTEM***********\n\n";
  cout << "\n\t" << "Main Menu";    
 cout << "\n\t" << "Select by letter:";
 cout << "\n\t" << "a - Add a customer.";    
 cout << "\n\t" << "d - Deposit money.";    
 cout << "\n\t" << "w - Withdraw money.";  
cout << "\n\t" << "s - Show Account Information.";    
cout << "\n\t" << "q - Quit Application.\n\n";  
cout  << "Choice: ";  
choice = getch();      switch(choice) {         case 'a':        
         system("cls");      int n;            
cust.getdata();      
system("cls");        
break;    
case 'd':  
 system("cls");    
cout << "\nEnter password: ";      
cin >> n;            cust.deposit();  
system("cls");            break;          case 'w':  
system("cls");      
cout << "\nEnter password: ";        
cin >> n;            cust.withdraw();      
system("cls");            break;        
case 's':          
     system("cls");
cust.showdata();      
   getch();            system("cls");    
break;          case 'q':      
                    z = 1;            break;    
 default:          
 cout << "\nInvalid selection. Press a key to return to main menu.";    
 getch();      }  
   if (z == 1)
 {         break;  
 }    }
return 0;}
Add caption

No comments:

Post a Comment