Run down of the if and else statements

Hi everyone. First off, I just want to state how glad I am that I found an active community for all sorts of programmers. Hopefully a newbie like me can find this place to be quite beneficial.

Now for my question. I'm writing a very basic program that calculates the value of speed based off of what the users defines as the 'distance' and 'time' variables. Once the user defines both 'distance (d)' and 'time (t)' the program spits out the value for 'speed (s)' in km/h.

After this the program poses a question to the user: "Would you like to see the Miles Per Hour conversion? Y/N"

It's basically asking whether or not the user would like to see that same result converted in to miles per hour, as I'm sure you could figure out. This where the IF statement comes in and ruins my day.

I need the program to display a unique message for whichever button (y or n) is pressed. So far, I can't seem to grab hold of this concept and it's doing nothing but frustrating me. Could any of you give me a rundown of how I would use the IF and ELSE statements in this situation?
[1181 byte] By [Zewt] at [2007-11-20 11:29:25]
# 1 Re: Run down of the if and else statements
char cReply;
cout << "Would you like to see the Miles Per Hour conversion? Y/N";
cin >> cReply;

if(cReply == 'Y')
{
// Do something
}
else if(cReply == 'N')
{
//Do something else
}
GCDEF at 2007-11-9 1:25:37 >
# 2 Re: Run down of the if and else statements
Of course! A char variable. Man that was a little thing that just flew under my radar. Yikes.

Would it also be possible to define a variable as more than one character? Say I wanted someone to enter their name? w/e a little dumb question.

Thanks for the help, GCDEF.
Zewt at 2007-11-9 1:26:37 >
# 3 Re: Run down of the if and else statements
of course you could do that using a string variable.
**star** at 2007-11-9 1:27:44 >