Dev-C++ Problem!

Okay. So here is the part im having trouble with:

cout << "Do you trust me?" << endl;
cout << "Put 1 for yes" << endl;
cout << "Put 2 for no" << endl;
cin >> t;
system("CLS");

if(t <= 1);
{
system("CLS");
cout << "That's Great!" << endl;
system("PAUSE");
}

if(t <= 2);
{
system("CLS");
cout << "Then our conversation is through!" << endl;
system("EXIT");
}
return 0;
}

I want it so if i put 2 it goes to "Then our conversation is through!
But it goes to "That's Great!"
Any advice?
1
2
3
if(t <= 1);
//...
if(t <= 2);


Don't put semicolons on if statements.
Also, indent and [ code ] [ /code ]
Okay.So now it is:

cin >> t;
system("CLS");

if(t <=1)
{
cout << "Then our conversation is through!" << endl;
system("PAUSE");
}
return 0;

if(t <=2)
{
cout << "That's Great!" << endl;
system("PAUSE");
}
}

The 1 works... but the 2 doesn't work.
It just exits.
That's because you're exiting after your first if block ("return 0;" exits the function -- and when you exit main, the program ends)
Dev C++ is no longer maintained. Why don't you use a compiler that is up to standard? There are plenty of free ones, like CodeBlocks.
Shouldn't "t" be "==" to 1 or 2 instead of "<="?
Last edited on
also you shouldnt use anything with system () in it
Topic archived. No new replies allowed.