C/C++ C++ Pointers & Classes: Translating $0-9999

  • Thread starter Thread starter ladykaelin
  • Start date Start date
  • Tags Tags
    Classes Pointers
AI Thread Summary
The discussion centers on creating a C++ program that translates whole dollar amounts from 0 to 9999 into English descriptions using pointers and classes. A participant seeks guidance on both the use of pointers and classes in C++, as well as the algorithm for converting numbers to text strings. Resources for learning about pointers and classes in C++ are suggested, including links to tutorials. The application itself is noted to primarily rely on conditional statements to process the number. A previous experience is shared where an Excel macro was used to break down numbers into three-digit chunks, processing each chunk to construct the final string representation. The approach emphasizes the importance of organizing the number into manageable parts for effective translation.
ladykaelin
Messages
1
Reaction score
0
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!
 
Technology news on Phys.org
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:
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
23
Views
2K
Replies
31
Views
3K
Replies
7
Views
11K
Replies
5
Views
3K
Replies
34
Views
4K
Back
Top