Using 2 variable as conditions?

I just started C++ 1 week ago and i was wondering what is the correct syntax to use 2 variable as conditions for example:

int main()
{
char Yes, No;
cout<<"Something\n";
cin>> Yes >> No;
if (Yes) {
cout<<"Cool\n";
}
else if ( No ) {
cout<<"Boo!\n";
}

Well yes something like that
What?
I don't even understand your example, and it should be in code tags. But you can code it like any other condition. Unlike switch, nothing says you cannot use different variables in the conditions for an if else if chain.
Of course keep in mind that testing true/false on a char could have unexpected results.
Well, thx for ur reply,
but my goal is like :
i usually type like
[...]
if ( a == 1 ) [...]

else if (a == 2) [...]


but my problem now is that i want to switch these condition to characters..
i tried but it would execute the if and else if command properly..
You wanted to use char?
It's as simple as slapping single quotes around 'em.
1
2
'2' is the character for 2
2 is the integer 2
I think you are looking for something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string answer;
    cout << "Something" << endl;
    cin >> answer;
    if (answer == "Yes") {
        cout << "Cool" << endl;
    }
    else if ( answer == "No" ) {
        cout << "Boo!" << endl;
    }
    else {
        cout <<"Say what?" << endl;
    }
    return 0;
}
Oh you mean string. (Maybe.)
By characters OP, I thought you meant one char.
@PanGalactic : THX!! That's exactly what i needed
and also thx to all who tried to help me!
Topic archived. No new replies allowed.