>the program doesn't save any of the user inputs into the variables input and number.
Don't type "true" or "false" unless you use the boolalpha manipulator, 1 and 0 should be used if you don't:
Code:
// prompt for user input and store in input and number
cout << "Enter true or false...";
cin >> boolalpha >> input;
cout << "Enter an integer...";
cin >> number;
>// output the solutions
>cout << " Your true and false answer converted to..." << output
> << endl << "Your integer was squared and the product is..." << number;
I think you want to print product instead of number.
Code:
int GetNumber(bool testbool)
{
int convrt=0;
if (testbool) // tests for a nonzero answer
convrt = 1;
else
convrt = 0;
return convrt;
}
This is overly complex. Why not just return the result of the boolean expression?
Code:
int GetNumber(bool testbool)
{
return testbool != false;
}
Or, since bool types are restricted to 0 and 1 anyway, you could simplify it even more like this:
Code:
int GetNumber(bool testbool)
{
return testbool;
}
Which begs the question, why a function anyway?