Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Pointers and classes

  1. Jul 14, 2009 #1
    Hi I am new using pointers and i am having a hard time trying to figure out how to write a program in c++ using pointers and classes. The program can be used to translate whole dollar amounts in the range 0 through 9999 into an English description of the number. For example, the number 713 would be translated into the string seven hunde thirteen, and 8203 would be translated into eight thousand hundred three, etc.,

    Any idea is helpful. Thanks!
     
  2. jcsd
  3. Jul 15, 2009 #2
    Are you looking for help on the use of c++ pointers/classes, or on the algorithm of translating numbers to text strings?

    For help on pointers, try http://www.cplusplus.com/doc/tutorial/pointers/

    For help on classes, try http://www.cplusplus.com/doc/tutorial/classes/

    Regarding the application, I don't think there is anything particularly clever that can be done other than a series of conditional statements. Some time ago, I made an excel macro to prepare text like that for cheque printing. The general idea was to split the number into chunks of three orders of magnitude (eg. the "millions", "thousands" and "ones").

    With that, each three-digit chunk was processed by my algorithm, which appended to a string based on the contents of that chunk. The whole thing was stitched together in the end, where proper place holders were stuck in.
     
    Last edited by a moderator: Apr 24, 2017
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Pointers and classes
  1. This pointer (Replies: 2)

  2. Pointer question (Replies: 2)

  3. Use of pointers (Replies: 3)

  4. Pointers and strings (Replies: 19)

Loading...