can anyone help me with this I have been trying to figure out this true false code for a couple days and i know its easier than I'm making it but I'm just stuck. So if anyone can help me with this it is C++ not java.C++ True False question code.?
I assume, based upon the way you are sending out text to the monitor, that you are requesting either a ';T'; or an ';F'; to be entered when asked for the answer.
Then you assign values of 1 and 2 respectively to two different Integers, called ';t'; and ';f'; which are never used later on in your code.
Then you proceed to test the ';answer'; for numeric values, which may not have been entered in the first place.C++ True False question code.?
First of all, did you declare ';answer'; as a char already? The cin function will read the result of the user's input to a variable (in this case, a char) named answer, and if it is undeclared, the program will not compile. In addition, you must use two equal signs in comparison ( == ). A single equal sign will assign the value to the variable, not compare it.
Also, declaring the ints t and f is unnecessary, in this context. Instead, try using:
if (answer == 't') {
cout%26lt;%26lt;';\nCorrect.';%26lt;%26lt;endl;
}
else {
cout%26lt;%26lt;';\nIncorrect,';%26lt;%26lt;endl;
}
if (a=b)
{
textbox1= true;
}
else
textbox1=false
use if, else statement...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment