Reputation: 43
I am trying to print the hexidecimal value of '\n' using cout.
cout<< hex << '\n' << dec<< endl;
whenever that line of code is reached it just moves to a new line it does not print the hex value. Thank you guys very much.
Upvotes: 1
Views: 657
Reputation: 595762
Streaming an actual '\n'
character as-is will always output a line break. You need to type-cast the value to an integer instead:
cout << hex << (int)'\n' << dec << endl;
Upvotes: 5