how do i print the character the character "
how do i print the character the character "
Use an escape sequence:
In other words:Code:\"
Code:std::cout << "This sentence uses two \"escape sequences\"" << std::endl;
Last edited by kermit; 12-30-2005 at 03:39 PM.
You don't have to escape the double quote if it's in single quotes:
Code:cout << '"' << "Ouch!" << '"' << ", he said.\n"; cout << "\"Ouch!\", he said.\n";
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Here's a list of them all:
Escape Sequence Description
\' Single quote
\" Double quote
\\ Backslash
\0 Null character
\a Audible bell
\b Backspace
\f Formfeed
\n Newline
\r Carriage return
\t Horizontal tab
\v Vertical tab
\xnnn Hexadecimal number (nnn)
And '\?' in C. ('\?' is the same as '?'; it's included to break up potential trigraphs.)
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.