PDA

View Full Version : How to write quotes in C++ ?



rico001
August 15th, 2003, 01:03
cout >> " "Hello" ";

how do I write something like ("Hello") with quotes in C++?

Thanks in advance.

icepir8
August 15th, 2003, 01:57
("/"HellO/"");

icepir8
August 15th, 2003, 02:16
cout >> "\"Hello\"";

I used the wrong slashes the last message.

Cyberman
August 15th, 2003, 20:26
I'm just a bit confused... should it not be


cout << "\"Hello!\"";
where << is the stream output operator?
>> as far as I know would cause your program to halt with an exception..
because firstly you are trying to first write to a string constant and secondly cout is an output only stream and you are trying to perform an input operation.

In fact I don't even believe it will compile that way :)

>> == stream input operator
<< == stream output operator

Cyb

blight
August 15th, 2003, 23:13
right, cyb ;)

aprentice
August 15th, 2003, 23:16
printf("\"Hello!\"\n");

is much better =p

Dominator
August 17th, 2003, 07:49
printf("\"Hello!\"\n");

is much better =p

if(!safeass) {printf("\"Take this workaround at 08%X in your face"\n");}
else{"\"You could still take it in your Xss"\n;}"

is closer to some reality :(