#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<<"================SELAMAT DATANG DI BANK BRI================="<<endl;
cout<<endl<<endl;
}
void ATM::input(){
cout<<"Masukan PIN anda : ";cin>>pin;
}
bool ATM::proses(){
if (pin != 1400018211){
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;
}
Jika Password ATM Benar
Jika Password ATM Salah
Tidak ada komentar:
Posting Komentar