Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream> //accept pin number and verify if correct
- using namespace std;
- int n, i,trans;
- int pin[4];
- int existingPin, trialPin, newPin;
- int main(){
- cout << "Welcome to BDO: Budie De Oro"<<endl;
- cout <<"<1>Enter New PIN" << endl << "<2>Change PIN" << endl<<"<3>Enter Existing PIN"<<endl;
- cin >> trans;
- switch(trans){
- case 1:
- cout << "Please enter your new PIN: ";
- cin >> pin[0];
- existingPin=pin[0];
- main();
- case 2:
- cout << "Please enter your existing PIN\n";
- for(i=0; i<4; i++){
- cin >> trialPin;
- if(trialPin == existingPin){
- cout << "Welcome " << existingPin <<"\n";
- cout << "Enter your new PIN ";
- cin >> newPin;
- existingPin = newPin;
- cout << "Your PIN has been changed \n";
- cout << endl;
- main();
- }
- else{
- cout <<"Error! Please enter PIN : ";}
- }
- case 3:
- cout << "Please enter your existing PIN \n";
- while(existingPin!=trialPin){
- cin >> trialPin;
- if(existingPin = trialPin){
- cout << "Validated" <<endl;
- exit (0);
- }
- else{
- cout << "ERROR! PIN IS INCORRECT\n" << "Try again "<<"\n";
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement