i cannot understand what setbase is

can you explain to me? is something about hex dec and oct but i dont understand

i know that hex is from 0 to f

dec 0 to 9

and

oct 0 to 7

does it have to do about this?

Printable View

- 07-05-2011cablesetbase
i cannot understand what setbase is

can you explain to me? is something about hex dec and oct but i dont understand

i know that hex is from 0 to f

dec 0 to 9

and

oct 0 to 7

does it have to do about this? - 07-05-2011Elysia
Simply put, std::setbase sets an output base. Which means that when you output a number, it converts that to the base you specified and outputs that instead of what you inputted.

For example, use std::setbase(16) and output 255, and you will get FF. Output 0xFF and you will get... that's right, FF. - 07-05-2011cable
but the exercise im reading tells 9 in base 10, is 11 in base 8

if its that you are telling what this sentence means - 07-05-2011Elysia
The number "9" in base 10 would be "10" in base 8.

- 07-05-2011tabstop
The decimal base we know and love is built on powers of 10: one, ten, hundred, thousand. The binary base is built on powers of 2: one, two, four, eight. So 1101(2) is eight+four+one=thirteen. Similarly octal is built on powers of eight and hex on powers of 16.

- 07-05-2011cable
ohhh yeah

god i have understand now

for some reason i got confused