#include <iostream>
int main()
{
std::cout << std::hex << 0b1111'1010'1111'1010 << " ";
std::cout << std::hex << 0x0123'4567'89ab'cdef << " ";
std::cout << std::dec;
std::cout << 123'456'789 << " ";
std::cout << 123'456.0 << " ";
std::cout << 9.012'345 << " ";
std::cout << std::endl;
return 0;
}
// Output: fafa 123456789abcdef 123456789 123456 9.01234
Reference: https://en.wikipedia.org/wiki/C%2B%2B14#Digit_separators
Monday, September 25, 2017
C++14: Digit separators
C++14 added digit separators (single apostrophes) that can be used to make literals easier to read. Here is an example:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment