Logo

Programming-Idioms

History of Idiom 142 > diff from v25 to v26

Edit summary for version 26 by jdashg:
New Cpp implementation by user [jdashg]

Version 25

2019-09-26, 18:30:31

Version 26

2019-09-26, 20:02:40

Idiom #142 Hexadecimal digits of an integer

Assign to string s the hexadecimal representation (base 16) of integer x.

E.g. 999 -> "3e7"

Idiom #142 Hexadecimal digits of an integer

Assign to string s the hexadecimal representation (base 16) of integer x.

E.g. 999 -> "3e7"

Extra Keywords
hex hexa radix
Extra Keywords
hex hexa radix
Imports
#include <sstream>
Code
std::ostringstream stream;
stream << std::hex << x;
s = stream.str();