#include <iostream>
//#include <cstdlib>
using namespace std;
int main()
{
int PIN;
int Amount;
int Balance;
int PINAttempts;
int count;
cout << endl;
cout << "Welcome to our ATM services." << endl << endl;;
PINAttempts=3;
while (PINAttempts>0)
{
cout << "Please enter your PIN." << endl;
cin >> PIN;
if (PIN == 1234)
{
cout << "PIN entry suceessful." << endl << endl;
PINAttempts= -1; //just a trick
}
else
{
cout << "Wrong PIN.Please try again." << endl << endl;
PINAttempts--;
cout << "nRemaining PIN Attempt chances: " << PINAttempts << endl <<endl;
}
if (PINAttempts == 0)
{
cout <<"You have exceeded the PIN attempt.Goodbye"<< endl <<endl;
}
if (PINAttempts == -1)
{
cout << "Please enter the amount to withdraw." << endl;
cin >> Amount;
cout << endl;
Balance=100000;
Balance=Balance-Amount;
cout << "You have withdrawn Ksh. " << Amount << "." << endl;
cout << "Your new Balance is Kshs. " << Balance << "." << endl << endl;
cout << "Thank you for using this ATM.Welcome back";
cout << endl;
}
}
//system("PAUSE");
main();
return 0;
}
For more information get help at CodeAvail- Online Computer Science Assignment
help