Falacy I need some help with my code for my programming class. I need to create a program where it converts whatever the number (integer) the user types in to string text form.
For example: The user types in 3452. The output should be three thousand four hundred and fifty two.
^^
ID:292221
![]() Feb 28 2011, 4:24 pm
|
|
![]() Feb 28 2011, 5:04 pm
|
|
And you're taking a DM class?
|
Convert the number to a string
Look at each "letter" from the string Use an associative list to pull the value for that "letter" - so "3"="Three" Use another associative list which checks the "depth" of the letter. So the 4th letter from the right would be 4="Thousand" The 2nd & 5th (etc) digits would need a special associative list, instead of five it would need fifty and such You would also need an extra check if the 2nd & 5th digits were a 1, since that would be a teen number or ten. And another check to add the "and" if the number is >=100 so it says one hundred and fifty three. You may need an extra check for 0s, since I'm not sure how VB handles null values in strings. |