to octal
cout << oct << int_value;
to binary
cout << binary << int_value;
but i get the following error
cc0ibaaa.o(.text+0x23):conver~1.cpp: undefined reference to `binary(int)'

what is wrong?

01-29-2003

pode

can u post the entire code or at least a little bit more?

01-29-2003

newbie_grg

umm..

well,
actually that is all the code. :)

Code:

#include <iostream>
int main(void)
{
int int_value;

cout << binary << int_value;
}

and the error is
cc0ibaaa.o(.text+0x23):conver~1.cpp: undefined reference to `binary(int)'

i use dev compiler.

01-29-2003

pode

wtf :eek:

first of all you must return a value when using int main
put return 0;
like this

Code:

#include <iostream>
int main(void)
{
int int_value;

cout << binary << int_value;
return 0;
}

and second what are you hoping the compiler will not just
put the binary of your int_value if you havent told the program how to change the value to binary
is this what you are trying to do?

01-29-2003

adrianxw

hex and oct are ANSI standard ios class manipulators, binary is not. Unless your compiler has a special, what you are trying will not work.

You can, of course, write your own manipulators.

01-29-2003

Hammer

>>first of all you must return a value when using int main
>>put return 0;
It's been discussed many times before.... return 0; is not required under C++. As for the matter of style... well that's your choice. Do a search if you want to know more.