Question: Help creating a functions that will check if answer is correct. C++ // this function receives a character corresponding to the answer entered by the
Help creating a functions that will check if answer is correct. C++
// this function receives a character corresponding to the answer entered by the user in main() and makes sure it is // either 'y' or 'n'. If the answer is incorrect, the functions keeps asking for the right answer until it is provided and // then returns it to main()
checkanswer( ) { }
int main( ) { // declare variable(s) to be used // ask the user if he would you like to continue // prompt the user to enter the answer // get the answer from the keyboard and store it in corresponding variable // determine which answer was entered by the user and // display "Yes" or "No" according to the answer provided by the user // must call the function to ensure the correct answer (y or n) is entered }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
