Mega Code Archive

 
Categories / C++ / String
 

Char Escapes

#include <iostream> #include <string> using namespace std; int main() {     string y1( "a\x62" );     cout << y1 << endl;   // y1 is string "ab".                                                            string y6( "a\xef" );     cout << y6 << endl;                                                                                           string w1( "a\142" );     cout << w1 << endl;                                                                                           string w2( "a\142c" );     cout << w2 << endl;                                                                                           string w3( "a\142142" );     cout << w3 << endl;                                                                                           string w4( "a\79" );     cout << w4 << endl;                                                                                           string w5( "\x00007p\x0007q\x0007r\x007s\x07t\x7u" );          cout << w5 << endl;      return 0; }