Im trying to figure out a way where I can check if the leftStr was picked I can return choice a or rightStr was picked so I can return choice b.
for example:
If I were to call GetChoice("seven", "eleven", 7, 11)
the user should see something like:
Please pick seven or eleven:
If they (eventually) enter "seven", the function should return the integer value 7.
string userInput; // Variable to store user input
cout << "Please pick " << leftStr <<" or " << rightStr;
cin >> userInput // Get user input
if(userInput == leftStr) // Check if what the user wrote is equal to leftStr
{
// return something
}
elseif(userInput == rightStr) // Check if what the user wrote is equal to rightStr
{
// return something else
}
That's that. But ask yourself the question. What happens if the user chooses neither of the options, and types "football" instead? Need to write something to handle that, using some kind of loop :)