Write "Enter the new base" Read newBase Write "Enter the number to be converted" Read decimalNumber Set quotient to 1 WHILE (quotient is not zero) Set quotient to decimalNumber DIV newBase Set remainder to decimalNumber REM newBase Make the remainder the next digit to the left in the answer Set decimalNumber to quotient Write "The answer is " Write answer
按要求的运行结果如下:
但是创建字典来进行进制转化的方法较为单一,如果要转化为更大的进制则必须创建更大的字典,不同的进制还得创造不同的字典并划分情况来运用,才能正常运行,较为冗杂。