Prints a table of the binary, octal and hexadecimal equivalents of the decimal numbers in the range 1-256. - C++ Data Type

C++ examples for Data Type:Binary

Description

Prints a table of the binary, octal and hexadecimal equivalents of the decimal numbers in the range 1-256.

Demo Code

#include <iostream>

int main(int argc, const char *argv[]) {
    std::cout << "Binary\tOctal\tHexadecimal\n";

    for (int i = 1; i <= 256; i++) {
        std::cout << std::dec << i << "\t" << std::oct << i << "\t" << std::hex << i << std::endl;
    }//from   ww w  .j a  v  a 2 s .  com
    return 0;
}

Result


Related Tutorials