Advertisement
HakdogForce

Untitled

Oct 23rd, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int pin[4]; //pin
  5. int ver_pin[4];
  6. int x;
  7.  
  8. int menu(){ // this function will call all other function to be executed in main function
  9. cout <<"\n---------+HONEY BANK+--------"<< endl;
  10. cout <<" [1] New User" << endl;
  11. cout <<" [2] Old User" << endl;
  12. cout <<"-----------------------------"<< endl;
  13. cout << "Select User type: ";
  14. cin >> x;
  15. if(x==1){
  16. new_User(); // calling function new_User
  17. }
  18. if(x==2){
  19. old_User(); // calling function old_User
  20. }
  21. }
  22.  
  23. int new_User(){
  24. system("cls");
  25. cout <<"***New User Registered***" << endl;
  26. cout << "\nEnter PIN: ";
  27. for(int i = 0; i < 1; i++){
  28. cin >> pin[i]; // save inputed value on pin array memory location 0
  29. }
  30.  
  31. cout << "\nVerify your Pin"<< endl;
  32. cout << "\nEnter new PIN again: ";
  33. for( int i = 0; i < 1; i++){
  34. cin >> ver_pin[i]; // also will save inputed value on ver_pin array memory location 0
  35. }
  36.  
  37. if(pin[0] == ver_pin[0]){
  38. cout << "You're now validated!" << endl;
  39. }
  40. else{
  41. cout << "Opsss! Error\nReturning to Menu" << endl;
  42. return menu(); // returning on function menu :: in short program will restart if [false]
  43. }
  44. }
  45.  
  46. int old_User(){
  47. system("cls");
  48. cout <<"***Log in User***" << endl;
  49. cout <<"Enter PIN: " << endl;
  50. for(int i = 0; i = < 2; i++){
  51. cin >> pin[i];
  52. }
  53. if(pin[1] == pin[0] && pin[1] == ver_pin[0]){
  54. cout << "Account Aunthecation Successful!" << endl;
  55. }
  56.  
  57. }
  58.  
  59.  
  60. int main(){
  61. menu();
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement