inserting a comma on the display

This is a discussion on inserting a comma on the display within the C++ Programming forums, part of the General Programming Boards category; I was given a good question and I can't figure it out. It says: Write a program that reads in ...

  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    29

    inserting a comma on the display

    I was given a good question and I can't figure it out. It says:

    Write a program that reads in an integer that is greater than 1,000 and less than 1,000,000. The number must be entered without a comma. Display the number with a comma inserted where it belongs. (Hint: use the % operator)

    How can this be solved?

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    How do you think it would be solved? Any thoughts on how you'd turn a million into a thousand?


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Oct 2009
    Posts
    29
    well, for your question I'd divide by 1000...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. display character size...(quite urgent..)
    By karthi in forum C Programming
    Replies: 10
    Last Post: 07-11-2007, 10:42 PM
  2. new problem with class
    By jrb47 in forum C++ Programming
    Replies: 0
    Last Post: 12-01-2006, 08:39 AM
  3. My text doesn't display
    By joeprogrammer in forum Game Programming
    Replies: 11
    Last Post: 02-23-2006, 10:01 PM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 10:44 AM

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