Download code - Download code - Qbasic
Back to Convert_integer_to_words_(QBASIC)
Download for Windows: single file, zip
Download for UNIX: single file, zip, tar.gz, tar.bz2
NUM2LANG.BAS
1 REM Copyright (c) 2009 the authors listed at the following URL, and/or 2 REM the authors of referenced articles or incorporated external code: 3 REM http://en.literateprograms.org/Convert_integer_to_words_(QBASIC)?action=history&offset=20070516003031 4 REM 5 REM Permission is hereby granted, free of charge, to any person obtaining 6 REM a copy of this software and associated documentation files (the 7 REM "Software"), to deal in the Software without restriction, including 8 REM without limitation the rights to use, copy, modify, merge, publish, 9 REM distribute, sublicense, and/or sell copies of the Software, and to 10 REM permit persons to whom the Software is furnished to do so, subject to 11 REM the following conditions: 12 REM 13 REM The above copyright notice and this permission notice shall be 14 REM included in all copies or substantial portions of the Software. 15 REM 16 REM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 REM EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 REM MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 REM IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 REM CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 REM TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 REM SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 REM 24 REM Retrieved from: http://en.literateprograms.org/Convert_integer_to_words_(QBASIC)?oldid=10097 25 26 DECLARE FUNCTION Num2Lang$ (aNumber AS LONG, aLang AS STRING) 27 28 DIM mTestCount AS INTEGER 29 DIM mStatus AS STRING 30 DIM mTest AS STRING 31 DIM mLang AS STRING 32 DIM mNumber AS LONG 33 DIM mExpected AS STRING 34 DIM mGot AS STRING 35 DIM mDelay AS SINGLE 36 DIM mTimer AS SINGLE 37 38 mTestCount = 0 39 RESTORE TestCases 40 DO 41 READ mTest 42 IF mTest = "" THEN 43 EXIT DO 44 ELSE 45 READ mLang, mNumber, mExpected 46 mTestCount = mTestCount + 1 47 END IF 48 LOOP 49 50 CLS 51 PRINT "1.." + LTRIM$(STR$(mTestCount)) 52 mTestCount = 0 53 RESTORE TestCases 54 mStatus = "" <a nam