As a safety precaution banks provide a feature that during any ATM transaction if someone comes and attacks, then the customer can enter the ATM pin in reverse order. This sends a message to the nearest police station. However if the reversed pin is the same as he original pin then no alarm is created. The bank needs a software application that checks that a user chooses an ATM pin whose reverse is not the same number. A software need to be developed with following requirements using while loop.
a. Read the pin number
b. Calculate the reverse the pin number
c. if the reversed pin is same as original pin then inform the user that this is an invalid pin number
#include <iostream>
using namespace std;
int main() {
const int NUM_GUESSES = 3;
int userGuesses[NUM_GUESSES];
int i;
for(int j=0; j<NUM_GUESSES; j++){
cin>>userGuesses[j];
}
for (i = 0; i < NUM_GUESSES; ++i) {
cout << userGuesses[i] << " ";
}
return 0;
}
Comments
Leave a comment