I have to write a program using a class to where, if a user puts in a number, such as 5678, the program will output "Five thousand six hundred seventy eight". I haven't started on the program yet, but how would I go about translating? Can someone lead me in the right direction?
Also, the question says:
The class should have a single integer member variable
int number;
and a collection of static string members that specify how to translate key dollar amounts into the desired format. For example, you might use static strings such as
Having the number 5678, you can convert to "5678" ( http://www.cplusplus.com/forum/articles/9645/ )
get the number of characters on the string (in this case 4).
104-1=103=1000 = "thousand"
now you get the first character in the string ('5') and convert it to "five"
so your string should be built like this: "five thousands"
Do something similar with the other digits.
Another way of getting digits (without using strings) is something like this: (5678-5678%1000)/1000 = 5