Breaking down a number

This is a discussion on Breaking down a number within the C++ Programming forums, part of the General Programming Boards category; im trying to write a fuction that takes in an integer and returns each of the three differnt digits in ...

  1. #1
    Unregistered
    Guest

    Breaking down a number

    im trying to write a fuction that takes in an integer and returns each of the three differnt digits in a seperate referance permater. Im completly lost as where to start to try to break the number down......please help

    thanks

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    85
    this function might help:

    int GetDigit(int number,int k)
    //return kth digit of number
    {
    return (int)(number/pow(10,k-1))%10;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Finding a number within a number
    By jeev2005 in forum C Programming
    Replies: 2
    Last Post: 01-10-2006, 07:57 PM
  2. Prime number program problem
    By Guti14 in forum C Programming
    Replies: 11
    Last Post: 08-06-2004, 04:25 AM
  3. help with a source code..
    By venom424 in forum C++ Programming
    Replies: 8
    Last Post: 05-21-2004, 12:42 PM
  4. parsing a number
    By juancardenas in forum C Programming
    Replies: 1
    Last Post: 02-19-2003, 12:10 PM
  5. Random Number problem in number guessing game...
    By -leech- in forum Windows Programming
    Replies: 8
    Last Post: 01-15-2002, 04:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21