Selasa, 30 Juni 2015

Program Pin ATM

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

using namespace std;

class ATM{
      public: ATM();
              void input();
              bool proses();
              void output();
      private: int pin;
      };

ATM :: ATM(){
cout<<"******** W e l c om e  to ********"<<endl;
  cout<<"********   B a n k  G O   ********"<<endl;
cout<<endl<<endl;
}

void ATM::input(){
     cout<<"Masukan PIN anda : ";cin>>pin;
}

bool ATM::proses(){     
     if (pin != 1400018246){
        return false;}
     else{
        return true;}
}

void ATM::output(){
     cout<<"Pilih Menu Transaksi :"<<endl;
     cout<<"1.Tarik Tunai"<<endl;
     cout<<"2.Transfer"<<endl;
     cout<<"3.Pembayaran"<<endl;
     cout<<"4.Info Saldo"<<endl;
     cout<<"5.Lain-lain\n"<<endl;
}


int main(int argc, char *argv[])
{   
    ATM go;
    for (int i=1;i<=3;i++){
        go.input();
        if (go.proses()==true){
           go.output();
           break;
        }
else if( (go.proses()==false) and (i==3)){
           cout<<"Maaf, anda sudah salah memasukkan PIN 3 kali ATM anda terblokir sementara"<<endl;
           break;
        }
else
           cout<<"Pin yang anda masukan salah, silakan coba lagi"<<endl<<endl;
    }
    
    system("PAUSE");
    return EXIT_SUCCESS;
}


Output : Teseted work in win7 enterprise x64


Share this

0 Comment to "Program Pin ATM"