if then statement

i need help with if then statements so when i input a certain answer it outputs a certain text

#include <iostream>
#include <cmath>


int main()
{
using namespace std;


char name[50];
char answer;

cout << "hello what is your name\n";
cin >> name;
cout << "nice to meet you " << name << endl;

cout << "how was your day\n";
cin >> answer;

if(answer = 4);
{
cout << "thats good to know" << endl;
}

if (answer < 4);
{
cout << "thats not good" << endl;
}
system("pause>nul");
}
We would be able to help more if you actually told us what problem you were having. I do spot a probably mistake of using the assignment in an if statement's condition, as well as having semicolons after them, creating empty if statement bodies.

I also recommend using [code][/code] tags around your code so it is readable.

Hi kmtom
this link to guide you how use Code tags :- http://www.cplusplus.com/forum/articles/42672/
if (answer = 4);

should be
if (answer == 4)

get rid of the semicolon at the end of the if statement and use == to compare to variables
and yes as Zhuge said there are some compile time errors that you have to clear first , then come up with very specific questions.
Topic archived. No new replies allowed.