37 lines
981 B
Text
37 lines
981 B
Text
To run:
|
|
Start up.
|
|
Test 123.
|
|
Test 12345.
|
|
Test 1234567.
|
|
Test 987654321.
|
|
Test 10001.
|
|
Test -10001.
|
|
Test -123.
|
|
Test -100.
|
|
Test 100.
|
|
Test -12345.
|
|
Test 1.
|
|
Test 2.
|
|
Test -1.
|
|
Test -10.
|
|
Test 2002.
|
|
Test -2002.
|
|
Test 0.
|
|
Wait for the escape key.
|
|
Shut down.
|
|
|
|
To get the middle three digits of a number giving a string:
|
|
Privatize the number.
|
|
De-sign the number.
|
|
Convert the number to the string.
|
|
If the string's length is less than 3, put "Number has fewer than three digits" into the string; exit.
|
|
If the string's length is even, put "Number has no middle" into the string; exit.
|
|
Put the string's length divided by 2 into a midpoint number.
|
|
Slap a substring on the string.
|
|
Put the substring's first plus the midpoint minus 1 into the substring's first.
|
|
Put the substring's first plus 2 into the substring's last.
|
|
Put the substring into the string.
|
|
|
|
To test a number:
|
|
Get the middle three digits of the number giving a string.
|
|
Write "" then the number then " -> " then the string on the console.
|