Help Me PLease

This is a discussion on Help Me PLease within the C++ Programming forums, part of the General Programming Boards category; This is my last exercise and i seriously can't get it done please help.... Write a program that inputs a ...

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    1

    Help Me PLease

    This is my last exercise and i seriously can't get it done please help....
    Write a program that inputs a five-digit integer, separates the integer into its individual digits and prints the digits separated from one another by three spaces each. [Hint: Use the integer division and modulus operators.] For example, if the user types in 42339, the program should print:


    4 2 3 3 9

  2. #2
    Registered User
    Join Date
    Oct 2006
    Location
    Canada
    Posts
    1,243
    First, you wont get much help if you dont make an attempt (or show your attempt if you have done so).

    Next:
    [Hint: Use the integer division and modulus operators.]
    This is the solution, let alone a "hint". Try the number, say, '12345'. What is this number modulo 10? (i.e. 12345 % 10)? That takes care of the "modulus" hint. You now need to think about what you do with the "division" hint.

Popular pages Recent additions subscribe to a feed

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