Question: Write a function named readOnePIN that reads in from the user a pin ( integer ) and ask the user re - enters the same

Write a function named "readOnePIN" that reads in from the user a pin (integer) and ask the user re-enters the same pin to verify.
It will return the indicator of true or false (match or not matched) and the number of tries the user has attempted.
The user can enter the wrong pin up to only 3 times.
Note: the function must return two separate values to the caller using return types and pass-by-reference parameters.
struct or tuple or pair is not allowed.
Printing is not allowed in the function. It can be done in the testing function or main.
Examples of the output of different program runs:
Please enter the pin: 1234
Please re-enter the pin: 1234
Matched: true
Number of tries: 1
Please enter the pin: 1234
Please re-enter the pin: 1111
Unmatched.
Please re-enter the pin: 2222
Unmatched.
Please re-enter the pin: 1234
Match: true
Number of tries: 3
Please enter the pin: 1234
Please re-enter the pin: 1111
Unmatched.
Please re-enter the pin: 2222
Unmatched.
Please re-enter the pin: 3333
Unmatched.
Match: false
Number of tries: 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!