I am confused of how to set up the loop here, the user will input a m for married or a s for single. If the user inputs anything else I want to redo this step. I have set it up in a way I think may work, but I am sure that it is not correct. Thanks for the help.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
do
{
cout << "\nPlease enter an \"m\" if married and filing joint return,";
cout << "\nor \"s\" if filing a single return: " << endl;
getline(cin, returnType);
if (returnType == "m")
{
if (returnType == "s")
{
}
}
else
{
cout << "that is an invalid character" << endl;
}
} while (returnType == false);
bool is_again; // Note
do
{
is_again = false; // Important! Otherwise is_again will never be false again
cout << "\nPlease enter an \"m\" if married and filing joint return,";
cout << "\nor \"s\" if filing a single return: " << endl;
getline(cin, returnType);
if (returnType == "m")
{
}
elseif (returnType == "s") // Note
{
}
else
{
is_again = true; // Note
cout << "that is an invalid character" << endl;
}
} while (is_again); // Note