>> The problem with mine was you cant == a string it has to be a int etc.
Unfortunately, that's wrong. Note that both g4j31a5 and MacGyver acknowledged it later.
You can use == on a string. The problem was the missing quotes. Try your original code but add quotes around bob.
I learn new stuff everyday.
Is there anything else that you can teach me?
>> Is there anything else that you can teach me?
Keep trying to do things on your own first, and when you get stuck feel free to ask questions here. You'll learn plenty.
@Swink: maybe one more minor thing. Add "std::" before the cin, cout, endl, and string. You won't get it to work without it. BTW the tutorials in this website can be found here.
>> Add "std::" before the cin, cout, endl, and string. You won't get it to work without it.
FYI, even though I prefer the std::, it can work without it if you have a using directive or using declarations. I assume Swink has that but just didn't include it in the posted code.
Your code is wrong. the "if(name==20)" will most likely returned false as you are comparing the pointer to the first character of the variable "name" against the integer 20. Not like what you wanted it to be.
Originally Posted by Saimadhav
Search on google for "Thinking in C++" and download the free electronic book and read it. That's certainly the best way to learn. Then ask questions on internet forums when you are stuck and you can't find the answer in the book.
Originally Posted by Swink