Advertisement
Sdub

exit shit

Oct 18th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. #include <iostream> //accept pin number and verify if correct
  2.  
  3. using namespace std;
  4. int n, i,trans;
  5. int pin[4];
  6. int existingPin, trialPin, newPin;
  7. int main(){
  8.  
  9. cout << "Welcome to BDO: Budie De Oro"<<endl;
  10. cout <<"<1>Enter New PIN" << endl << "<2>Change PIN" << endl<<"<3>Enter Existing PIN"<<endl;
  11. cin >> trans;
  12. switch(trans){
  13. case 1:
  14. cout << "Please enter your new PIN: ";
  15. cin >> pin[0];
  16. existingPin=pin[0];
  17. main();
  18. case 2:
  19. cout << "Please enter your existing PIN\n";
  20. for(i=0; i<4; i++){
  21. cin >> trialPin;
  22. if(trialPin == existingPin){
  23. cout << "Welcome " << existingPin <<"\n";
  24. cout << "Enter your new PIN ";
  25. cin >> newPin;
  26. existingPin = newPin;
  27. cout << "Your PIN has been changed \n";
  28. cout << endl;
  29. main();
  30. }
  31. else{
  32. cout <<"Error! Please enter PIN : ";}
  33. }
  34. case 3:
  35. cout << "Please enter your existing PIN \n";
  36. while(existingPin!=trialPin){
  37. cin >> trialPin;
  38. if(existingPin = trialPin){
  39. cout << "Validated" <<endl;
  40. exit (0);
  41. }
  42. else{
  43. cout << "ERROR! PIN IS INCORRECT\n" << "Try again "<<"\n";
  44. }
  45.  
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement