// An exabyte (binary) is:
// 1 EiB = 2 ^ 60 bytes = 1,152,921,504,606,846,976 bytes
#include <iostream>
#include <format>
constexpr std::size_t EXABYTE = 1ULL << 60; // 1 EiB
constexpr std::size_t EXABYTE_DEC = 1'000'000'000'000'000'000ULL; // 1 EB
int main() {
std::size_t size = EXABYTE;
std::cout << "1 EiB = " << size << " bytes\n";
// The std::format Approach (C++20)
// The ':L' tells format to use the locale provided
std::cout << "1 EiB = "
<< std::format(std::locale("en_US.UTF-8"), "{:L}", size) << " bytes\n";
return 0;
}
/*
run:
1 EiB = 1152921504606846976 bytes
1 EiB = 1,152,921,504,606,846,976 bytes
*/