HakdogForce

Untitled

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