View Full Version : C++ mandare in output caratteri / " \
limpid-sky
03-08-2011, 10:08
ho difficoltà a fare anche un semplice cout<<""\\//"; per fare un esempio visto che la dobbia barra mi viene segnalata come commento, non riesco a stampare tutti questi caratteri che possono inteferire con la sintassi del linguaggio.
riporto da QUI (http://msdn.microsoft.com/en-us/library/69ze775t%28v=vs.80%29.aspx):
Because the double quotation mark (") encloses strings, use the escape sequence (\") to represent enclosed double quotation marks. The single quotation mark (') can be represented without an escape sequence. The backslash character (\) is a line-continuation character when placed at the end of a line. If you want a backslash character to appear within a string, you must type two backslashes (\\). (See Phases of Translation in the Preprocessor Reference for more information about line continuation.)
in sostanza, se vuoi stampare \\// dovrai usare il seguente codice:
cout << "\\\\//";
limpid-sky
07-08-2011, 20:24
grazie visto solo ora.:)
vBulletin® v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.