Logo

Programming-Idioms

History of Idiom 142 > diff from v35 to v36

Edit summary for version 36 by programming-idioms.org:
[C++] Repl.it now requires code ownership

Version 35

2020-10-08, 13:04:44

Version 36

2020-11-21, 21:38:29

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"

Variables
s,x
Variables
s,x
Extra Keywords
hex hexa radix sexadecimal sixteen
Extra Keywords
hex hexa radix sexadecimal sixteen
Imports
#include <sstream>
Imports
#include <sstream>
Code
std::ostringstream stream;
stream << std::hex << x;
s = stream.str();
Code
std::ostringstream stream;
stream << std::hex << x;
s = stream.str();
Demo URL
https://repl.it/repls/VariableMediumblueService
Demo URL
https://repl.it/@ProgIdioms/VariableMediumblueService