PDA

Click to See Complete Forum and Search --> : Console Number Problem


Emo
Jan 27th, 2003, 12:24 AM
Hello all!

How would I reverse a number that is given by the user?? I have no idea how to do this! I'm using a regular Console App and also using C not C++

can somebody explain to me the steps I need to take?

thanks!
-Emo

rekcus
Jan 27th, 2003, 01:36 AM
1 Store the number in a string
2 Declare another char[] of same strlen
3 Copy the constant at x position of char1 to strlen-x position of char2
4 Do an atoi or atol

Emo
Jan 27th, 2003, 01:58 AM
Thanks!

though, I didnt understant what you mean by teh 4th step...

-Emo

parksie
Jan 27th, 2003, 03:39 AM
atoi converts a string to an integer. I have a nagging feeling it's not a standard function though...that could be itoa....perhaps.

CornedBee
Jan 27th, 2003, 10:51 AM
Nope, atoi is standard, itoa is not.