Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

Conduct a needs assessment. page 269

Answered: 1 week ago