Results 1 to 5 of 5

Thread: Console Number Problem

  1. #1

    Thread Starter
    Hyperactive Member Emo's Avatar
    Join Date
    Jul 2000
    Posts
    428

    Console Number Problem

    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
    -=VB6 Enterprise Edition=-
    -=VC++6Enterprise Edition=-
    «¤E³m°O²™¤»

  2. #2
    Lively Member rekcus's Avatar
    Join Date
    Jan 1999
    Location
    Kuala Lumpur
    Posts
    122
    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
    penyou!

    "The code bytes.."

  3. #3

    Thread Starter
    Hyperactive Member Emo's Avatar
    Join Date
    Jul 2000
    Posts
    428
    Thanks!

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

    -Emo
    -=VB6 Enterprise Edition=-
    -=VC++6Enterprise Edition=-
    «¤E³m°O²™¤»

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    atoi converts a string to an integer. I have a nagging feeling it's not a standard function though...that could be itoa....perhaps.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Nope, atoi is standard, itoa is not.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width