40 lines
1.5 KiB
Plaintext
40 lines
1.5 KiB
Plaintext
'''Ordinal numbers''' (as used in this Rosetta Code task), are numbers that describe the ''position'' of something in a list.
|
|
|
|
It is this context that ordinal numbers will be used, using an English-spelled name of an ordinal number.
|
|
|
|
|
|
The ordinal numbers are (at least, one form of them):
|
|
1st 2nd 3rd 4th 5th 6th 7th ··· 99th 100th ··· 1000000000th ··· etc
|
|
|
|
sometimes expressed as:
|
|
1<sup>st</sup> 2<sup>nd</sup> 3<sup>rd</sup> 4<sup>th</sup> 5<sup>th</sup> 6<sup>th</sup> 7<sup>th</sup> ··· 99<sup>th</sup> 100<sup>th</sup> ··· 1000000000<sup>th</sup> ···
|
|
|
|
|
|
For this task, the following (English-spelled form) will be used:
|
|
first second third fourth fifth sixth seventh ninety-nineth one hundredth one billionth
|
|
|
|
|
|
Furthermore, the short scale numbering system (i.e. 2,000,000,000 is two billion) will be used here. [[wp:Long and short scales]]
|
|
|
|
'''2,000,000,000''' is two billion, ''not'' two milliard.
|
|
|
|
|
|
;Task:
|
|
Write a driver and a function (subroutine/routine ···) that returns the English-spelled ordinal version of a specified number (a positive integer).
|
|
|
|
Optionally, try to support as many forms of an integer that can be expressed: '''123''' '''00123.0''' '''1.23e2''' all are forms of the same integer.
|
|
|
|
Show all output here.
|
|
|
|
|
|
;Test cases:
|
|
Use (at least) the test cases of:
|
|
1 2 3 4 5 11 65 100 101 272 23456 8007006005004003
|
|
|
|
|
|
;Related tasks:
|
|
* [[Number names]]
|
|
* [[N'th]]
|
|
<br><br>
|
|
|