213k views
2 votes
Create a test that prompts a user to enter a 5-digit PIN in the main procedure and then calls Validate PIN procedure to validate the user pin. Declare two arrays to hold the minimum and maximum range values, and use these arrays to validate each digit of the PIN. If any digit is found to be outside its valid range, your program displays "Invalid Pin" to the user. If the entire PIN is valid, shows "Valid Pin".

1 Answer

6 votes

Answer:

See explaination

Step-by-step explanation:

#include <iomanip>

#include <string>

#include <fstream>

using namespace std;

void getName(string);

void getPin(int,int);

void displayMenu(int);

string name;

int pin1, pin2, ch ;

int main()

{

cout << fixed << showpoint << setprecision(2);

getName(name);

getPin(pin1,pin2);

displayMenu(ch );

system("pause");

}

void getName(string name)

{

cout << "Enter your name: ";

cin >> name;

if (name = "AXBY") || (name != "ABGSHY"))

{

getName(name);

}

}

void getPin(int pin1, int pin2)

{

string name;

if (name == "AXBY")

{

cout << "Please Enter Pin: ";

cin >> pin1;

if (pin1 != 4433)

{

cout << "Pin incorrect please try again!";

cin >> pin1;

}

}

if (name == "ABGSHY")

{

cout << "Please Enter Pin: ";

cin >> pin2;

if (pin2 != 2849)

{

cout << "Pin incorrect please try again!";

cin >> pin2;

}

}

}

void displayMenu(int ch )

{

cout << "[1] Check your account Balance\\"

"[2] Withdraw funds\\"

"[3] Deposit funds\\"

"Please Enter Choice: ";

cin >> ch ;

if (ch != 1 || ch != 2 || ch != 3)

{

cout << "Choice is incorrect, enter choice now: ";

cin >> ch ;

}

}

User Dast
by
5.0k points