I need 5 T or F questions with the option to input the answer and then add the correction to answer if right or wrong.
i just need random questions!

I am thinking of going to school for computer programming and my FIL is a programmer.

#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
int True;
int False;
{
if (userresponse != 'T' && userresponse != 'F')
	cout << " Cows have 7 stomachs"
	cin >> userresponse
else
cout << " You responded True " << endl;

Edited 6 Years Ago by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

I need 5 T or F questions with the option to input the answer and then add the correction to answer if right or wrong.
i just need random questions!

I am thinking of going to school for computer programming and my FIL is a programmer.

#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
int True;
int False;
{
if (userresponse != 'T' && userresponse != 'F')
    cout << " Cows have 7 stomachs"
    cin >> userresponse
else
cout << " You responded True " << endl;

end quote.

you need to declare usserresponse and its better if you use brackets for if..else statments. its much neater and u dont need brackets before the if

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Hey, a new programmer, welcome! I remember playing with code for the first time, and wondering why it would not compile :) Make sure that you include a semicolon after the cout and cin lines. You should also declare userresponse as a string before you use it:

char userresponse;

I recommend moving your cin line up too, so that the user can input text before your if statement checks the input. If you make those changes, and add a couple of bracket on the end:

}}

then your code should work fine.

By the way, one of the best ways to learn, is to look through some of the free online C++ tutorials. If you google C++ tutorial, a bunch of good ones will come up.

This article has been dead for over six months. Start a new discussion instead.