Question: Details: Write a GetYesOrNo Input function in input.cc and use it in main.cc where you ask the user for input. The function takes no arguments

 Details: Write a GetYesOrNo Input function in input.cc and use it

Details: Write a GetYesOrNo Input function in input.cc and use it in main.cc where you ask the user for input. The function takes no arguments and returns a boolean of whether the user answered yes (true) or no (false). Do not assume that the user will type their input correctly. GetYesorNo Input needs to keep trying to get input from the user until either the input is exactly yes or the input is exactly no . If the user types the input incorrectly, your function should print, Sorry, I didn't understand. Try again: and then wait for the user to enter another response. You will need to define GetYesor NoInput in input.h and include input.h from main.cc so the compiler knows about the function's definition. To compile and run your program, you'll need to ensure that the function implementation in input.cc can be found, so pass is as another argument to clang++: clang++ -std=C++17 main.cc input.cc -o main ./main Here's an example of running main after your function is implemented: Do you like chocolate chip cookies? Enter "yes" or "no": potato Sorry, I didn't understand. Try again: 3 Sorry, I didn't understand. Try again: YES Sorry, I didn't understand. Try again: yes Yummy yummy chocolate chip cookies

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!