Thread: solution:jumping into c++ chapter 7 exercise 1 (turn numbers into English text)

  1. #1
    Registered User
    Join Date
    Aug 2012
    Posts
    11

    Question solution:jumping into c++ chapter 7 exercise 1 (turn numbers into English text)

    Hi,everyone
    I'm tring to solve this problem ,but i have no idea how to break the number up into chunks of 3 digits and compute the text of a three digit chunk……Just help me! Thanks!

  2. #2
    Registered User
    Join Date
    Aug 2012
    Posts
    11
    who can help me ?
    "Imagine trying to come up with an algorithm for a program that displayed the English
    name for a number (example: 1204, one thousand, two hundred four). "
    How to work it out?

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    Quote Originally Posted by just_rookie
    "Imagine trying to come up with an algorithm for a program that displayed the English
    name for a number (example: 1204, one thousand, two hundred four). "
    How to work it out?
    Start with non-negative numbers less ten, then expand it to work with numbers less than a hundred, then numbers less than a thousand.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Registered User
    Join Date
    Aug 2012
    Posts
    11
    Thank you! Please post your code ,and i think i will learn something form your code !Thank you again!

  5. #5
    Registered User
    Join Date
    Aug 2012
    Posts
    11
    Quote Originally Posted by laserlight View Post
    Start with non-negative numbers less ten, then expand it to work with numbers less than a hundred, then numbers less than a thousand.
    Thank you! Please post your code ,and i think i will learn something form your code !Thank you again!

  6. #6
    Registered User
    Join Date
    May 2010
    Posts
    4,633
    How about you posting your code where you are trying to solve your problem. You will learn much more by writing the code yourself than by "looking" at someone else's code. If you don't understand something then ask specific questions. Hopefully if the book is giving you a problem to solve it has already explained the basics of solving the problem.

    Jim

  7. #7
    Registered User
    Join Date
    Aug 2012
    Posts
    11
    Quote Originally Posted by jimblumberg View Post
    How about you posting your code where you are trying to solve your problem. You will learn much more by writing the code yourself than by "looking" at someone else's code. If you don't understand something then ask specific questions. Hopefully if the book is giving you a problem to solve it has already explained the basics of solving the problem.

    Jim
    Thank you very much!You taught me a very important lesson!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 04-02-2012, 05:42 AM
  2. Jumping into C++ Chapter 5 problem 6 - Critique please
    By Kranky in forum C++ Programming
    Replies: 8
    Last Post: 03-07-2012, 05:44 PM
  3. Replies: 2
    Last Post: 02-16-2012, 03:03 PM
  4. Request for feedback -- exercise solution.
    By msh in forum C Programming
    Replies: 4
    Last Post: 07-07-2010, 12:48 PM
  5. C++ program help(converting numbers to english words)
    By bama1 in forum C++ Programming
    Replies: 4
    Last Post: 10-08-2002, 01:17 AM