0

Hello,
I'm learning C++, then i want to know how i can do a convertion of an decimal number to an hexamal number, i know the calculation form to do this, but the thing that i don't know is how i can represent the remain in the formula. Here is an example of a convertion of the number 42(in decimal to hexamal):

42 : 16 = 2
Remain 10.
10 in hexamal is A.
Then 42 in hexamal is 2A

How i can do a program that knows what is tha remain, this is my question?

Thanks,
Nathan Paulino Campos

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Nathan Campos
0

Pick 1)

I)

std::cout<<hex;

II)

hex(cout);

III)

cout.setf(ios_base::hex,ios_base::basefield);

All these shows the output in hex. So no calculation needed.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.