Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int pin[4]; //pin
- int ver_pin[4];
- int pin_1[4];
- int x;
- int new_User();
- int old_User();
- int menu(){ // this function will call all other function to be executed in main function
- cout <<"\n---------+HONEY BANK+--------"<< endl;
- cout <<" [1] New User" << endl;
- cout <<" [2] Old User" << endl;
- cout <<"-----------------------------"<< endl;
- cout << "Select User type: ";
- cin >> x;
- if(x==1){
- new_User(); // calling function new_User
- }
- if(x==2){
- old_User(); // calling function old_User
- }
- }
- int new_User(){
- system("cls");
- cout <<"***New User Registered***" << endl;
- cout << "\nEnter PIN: ";
- for(int i = 0; i < 1; i++){
- cin >> pin[i]; // save inputed value on pin array memory location 0
- }
- cout << "\nVerify your Pin"<< endl;
- cout << "\nEnter new PIN again: ";
- for( int i = 0; i < 1; i++){
- cin >> ver_pin[i]; // also will save inputed value on ver_pin array memory location 0
- }
- if(pin[0] == ver_pin[0]){
- cout << "You're now validated!" << endl;
- return old_User();
- }
- else{
- cout << "Opsss! Error\nReturning to Menu" << endl;
- return menu(); // returning on function menu :: in short program will restart if [false]
- }
- }
- int old_User(){
- system("cls");
- cout <<"***Log in User***" << endl;
- cout <<"Enter PIN: ";
- for(int i = 0; i < 1; i++){
- cin >> pin_1[i];
- }
- 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
- cout << "Account Aunthecation Successful!" << endl;
- }
- }
- int main(){
- menu();
- }
Add Comment
Please, Sign In to add comment