Thread: c++ variables

  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    3

    Question c++ variables

    if a got a int variable whit the numbers 1357 in it how can i make it to split so i get 1 in int x. 3 in int y.5 in int z.......

  2. #2
    Registered User
    Join Date
    Feb 2009
    Posts
    42
    Imagine the integer 123. Now imagine the integer 100.

    Assuming the result is an integer value, what's the result of 123/100?

    How about 123%10?

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    3
    thx one more question is there a way to calculate how many numbers there are in the int??

  4. #4
    Registered User
    Join Date
    Feb 2009
    Posts
    42
    Take 123 as example again. If you do 123/1000, what's the result?

    Now, isn't that the same as 123/10/10/10?

    How many digits does 123 have?
    How many divisions by 10 have you made?

  5. #5
    Registered User
    Join Date
    Mar 2009
    Posts
    3
    thx :P i feel little stupid that i couldn't figure that our for my self xD

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. basic question about global variables
    By radeberger in forum C++ Programming
    Replies: 0
    Last Post: 04-06-2009, 12:54 AM
  2. Replies: 15
    Last Post: 09-30-2008, 02:12 AM
  3. esbo's data sharing example
    By esbo in forum C Programming
    Replies: 49
    Last Post: 01-08-2008, 11:07 PM
  4. Craps Program with Local Variables
    By tigrfire in forum C Programming
    Replies: 12
    Last Post: 11-09-2005, 09:01 AM
  5. Declaring an variable number of variables
    By Decrypt in forum C++ Programming
    Replies: 8
    Last Post: 02-27-2005, 04:46 PM

Tags for this Thread