1 PointerToCharacter elements[13] := {"I", "IV", "V",
2 "IX", "X", "XL",
3 "L", "XC", "C",
4 "CD", "D", "CM",
5 "M"};
6 Integer16 meaningsOfElements[13] := { 1, 4, 5,
7 9 10, 40,
8 50, 90, 100,
9 400, 500, 900,
10 1000};
11 Character result[64];
12 Function pointerToResult() Which Returns PointerToCharacter Does
14 Return AddressOf(result[0]);
15 EndFunction
16
17 Function strcat(PointerToCharacter dest, PointerToCharacter src)
18 Which Returns Nothing Is Declared;
19
20 Function convertToRomanNumerals(Integer16 number) Which Returns Nothing Does
21 result[0] := 0;
22 PointerToCharacter result := pointerToResult();
23 If number = 0 Then
24 strcat(result,"N");
25 Return;
26 ElseIf number < 0 or number > 4000 - 1 Then
27 strcat(result,"\"Please enter a number between 0 and 4000.\"");
28 Return;
29 EndIf
30 Integer32 pointerToElement := 12; While number Loop
32 If number > meaningsOfElements[pointerToElement] - 1 Then
33 strcat(result, elements[pointerToElement]);
34 number -= meaningsOfElements[pointerToElement];
35 Else
36 pointerToElement -= 1;
37 EndIf
38 EndWhile
39 EndFunction
40
41 Function strlen(PointerToCharacter str) Which Returns Integer32 Does
42 Integer32 length : = 0;
43 While ValueAt(str + length) Loop
44 length += 1;
45 EndWhile
46 Return length;
47 EndFunction
48
49 Function strcpy(PointerToCharacter dest,
50 PointerToCharacter src) Which Returns Nothing Does
51 While ValueAt(src) Loop
52 ValueAt(dest) := ValueAt(src);
53 dest += 1;
54 src += 1;
55 EndWhile
56 ValueAt(dest) : = 0;
57 EndFunction
58
59 Function strcat(PointerToCharacter dest,
60 PointerToCharacter src) Which Returns Nothing Does
61 strcpy(dest + strlen(dest), src);
62 EndFunction
63