does everyone agree that if i check the numbers 1 to 19 inclusive and they are right, and i check the numbers 10 to 90 inclusive and they are rright there is no point in checking 21 for ecample as it cant be wrong as 1 and 20 are correct.
does everyone agree that if i check the numbers 1 to 19 inclusive and they are right, and i check the numbers 10 to 90 inclusive and they are rright there is no point in checking 21 for ecample as it cant be wrong as 1 and 20 are correct.
I suspect you won't like this answer, but 40 is spelt "forty".
I get 21124 with the correct spelling.
Ironically, your original numeric case statement had the right number of characters.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I didn't skim the codes, but you have to account for the hundreds and above, when the magnitude is greater than 1 too:
100 = one hundred
200 = two hundreds
1000 = one thousand
2000 = two thousands
1000000 = one million
2000000 = two millions
And there is the conjunction "and". Example: 2345 = two thousands, three hundreds and forty five.
This "and" can happen more than once. Example: 123456: one handred and twenty three thousands, four hundreds and fifty six.
There is another complexity to add to the mix: Take 1123 and 1023 as examples:
1123 = one thousand, one hundred and twenty three.
1023 = one thousand and twenty three (no commas!)...
Last edited by flp1969; 06-09-2019 at 08:59 AM.
yep i just checked that what an idiot lol i was just about to type it allows me to type forty here with out correcting it then realised i had misspelt it in the array
Last edited by cooper1200; 06-09-2019 at 08:59 AM.
@ flp if you wrote down the number 312 in words you would say three hundred and twelve. there would be no plural for the hundred.
ok now this has annoyed me.... i just uncommented the switch statements and it worked!! i haven't changed any of the code all i have done is reorder things in count letters so it prints the words in the right order.
flp i except your point but the exercise was for singular hundreds.
> And there is the conjunction "and". Example: 2345 = two thousands, three hundreds and forty five.
> This "and" can happen more than once. Example: 123456: one handred and twenty three thousands, four hundreds and fifty six.
coop has it right, they are singular when spelling out numbers as words.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
if i was counting somthing i might say i counted in thousands or i counted in hundreds or if someone asked me how much something cost for example. If it was a lot of money i was a little embarrassed about it i might say it cost hundreds. project euler though said to count the word and and not the spaces. and gave an example of three hundred and forty two having 23 letters. so i followed that format.
> Notice, I'm not qualifying the numbers as in "two thousand dollars"...
The plural goes to the subject.
You don't say "two thousands dollar" for example.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Yep... I've got this hence I told not applying "qualifiers" or objects to the spelling.
One can argue that since quantities greater than a unit are already expressing more then 1 thing, it doen't make sense to use plurals on "hundred", "thousand" and so forth... But I think this is the coloquial way only, isn't it? If the rule is to NEVER use plural to these groupings, then sentences as "I have hundreds of dollars in my pocket" (poket is the object, singular!) or "they were killed by the millions" (They, as the "subject" already express plural!) makes no sense...
"Oh... but in these examples you are expressing a notion of magnitude only!". The same way one's do when using "thousand", "hundred", etc...
Well... Quirks of any language, I guess...
What about the other issue? The usage of "and"? You could substitute "and"s by commas, as in: 1023 "one throusand and twenty three" by "one thousand, twenty three" or 1123 "one thousand, one hundred [and or ,] twenty three"...
It's commas all the way, except for the final and.
Eg
Twenty two million, three hundred and forty thousand, nine hundred and seventy six.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.