Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

converting octal numbers to standard output

Status
Not open for further replies.

87vette

Programmer
Mar 4, 2002
9
US
I have a program that i have to do for school. i have to convert octal, hex, and binary to its standard output
and print out an how many overflows are read from the file
I have to read from: example 0b0101 -012 0x05A -123
the output should be something like this

Binary 5
octal -10
Decimal -123
Hexadecimal 90

any ideas how to right functions so that it can convert
the numbers?


the only hint the instructor gave us it to use a function
something like this: int getnum(int *error, int *radix, int *characters_read)

any help would greatly appreciated Nail the code
 
Not sure exactly what you're trying to do here, but just in case you didn't know, in the function that your professor pointed out the radix is in essence the base. If you're reading in those numbers just figure out what base they're in and read them accordingly. To output if you're using std::cout there are flags you can use to specify what base you are outputing in. Hope this helps. Your example is a little blurry. Good luck. MYenigmaSELF:-9
myenigmaself@myenigmaself.gaiden.com
"If debugging is the process of removing bugs, then programming must be the process of putting them in." --Dykstra
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top