| 1 |
/* |
| 2 |
* test adv3_num's spellInt() function |
| 3 |
*/ |
| 4 |
|
| 5 |
#include "adv3.h" |
| 6 |
|
| 7 |
main(args) |
| 8 |
{ |
| 9 |
if (args.length() < 2) |
| 10 |
{ |
| 11 |
"usage: adv3_num <number> ...\n"; |
| 12 |
return; |
| 13 |
} |
| 14 |
|
| 15 |
/* |
| 16 |
* spell each argument value, and give each number's Roman numeral |
| 17 |
* representation |
| 18 |
*/ |
| 19 |
for (local i = 2, local cnt = args.length() ; i <= cnt ; ++i) |
| 20 |
{ |
| 21 |
"<<args[i]>>:\n"; |
| 22 |
"\t<<spellInt(toInteger(args[i]))>>\n"; |
| 23 |
"\t<<spellIntExt(toInteger(args[i]), SPELLINT_TEEN_HUNDREDS)>>\n"; |
| 24 |
"\t<<spellIntExt(toInteger(args[i]), SPELLINT_AND_TENS)>>\n"; |
| 25 |
"\t<<spellIntExt(toInteger(args[i]), |
| 26 |
SPELLINT_AND_TENS | SPELLINT_COMMAS)>>\n"; |
| 27 |
"\t<<spellIntBelowExt(toInteger(args[i]), 100, |
| 28 |
0, INTDEC_GROUP_SEP)>>\n"; |
| 29 |
"\t<<intToRoman(toInteger(args[i]))>>\n"; |
| 30 |
} |
| 31 |
} |
| 32 |
|