Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
MODULE addstr;
|
||||
|
||||
IMPORT Out, Strings;
|
||||
|
||||
VAR str1, str2 : ARRAY 9 OF CHAR;
|
||||
num, pos : INTEGER;
|
||||
carry : BOOLEAN;
|
||||
ch : CHAR;
|
||||
|
||||
BEGIN
|
||||
str1 := "9999";
|
||||
Out.Char ('"'); Out.String (str1); Out.String ('" + 1 = ');
|
||||
num := Strings.Length (str1) - 1;
|
||||
pos := num;
|
||||
IF str1 [0] = '9' THEN INC (pos) END;
|
||||
str2 [pos + 1] := 0X;
|
||||
carry := TRUE;
|
||||
REPEAT
|
||||
ch := str1 [num];
|
||||
IF carry THEN
|
||||
ch := CHR (ORD (ch) + 1)
|
||||
END;
|
||||
IF ch > '9' THEN
|
||||
carry := TRUE;
|
||||
ch := '0'
|
||||
ELSE
|
||||
carry := FALSE
|
||||
END;
|
||||
str2 [pos] := ch;
|
||||
DEC (num);
|
||||
DEC (pos)
|
||||
UNTIL num < 0;
|
||||
IF carry THEN str2 [0] := '1' END;
|
||||
Out.String (str2);
|
||||
Out.Ln
|
||||
END addstr.
|
||||
Loading…
Add table
Add a link
Reference in a new issue