0
Conversion from 10 base number to any other base without using function and arrays
How can I write it's program in c++?!
1 Answer
0
"To any other base" is not completely feasible, without writing your own helper function, or using language built-in feature e.g. std::bitset for binary conversion.
However, you can format decimal integer in octal or hexadecimal using std::oct or std::hex
int decimal {2022};
std::cout << std::oct << decimal << '\n';
std::cout << std::hex << decimal << '\n';
References:
https://en.cppreference.com/w/cpp/io/manip/fixed
https://en.cppreference.com/w/cpp/io/manip/hex