0

Conversion from 10 base number to any other base without using function and arrays

How can I write it's program in c++?!

5th May 2022, 8:18 PM
Zeynab nejadmahdi
1 Resposta
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
6th May 2022, 2:33 AM
Ipang