-
Notifications
You must be signed in to change notification settings - Fork 2
/
sample004.ptuc
50 lines (39 loc) · 1.07 KB
/
sample004.ptuc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
@defmacro N 100
program useless;
type
string = array of char;
var i, k: integer;
procedure nl();
begin writeString('\n') end;
(* This is a rather silly function *)
procedure compute(n: integer; k:integer);
var fac, p, j: integer;
function cube(i: integer): integer;
begin
result := i * i * i;
return
end;
begin
fac := 1;
j := (integer) (N - n) + cube(k);
for p:=j downto 1 do fac:=p*fac;
writeString("Computed (N-n)+k^3 = ");
writeInteger(j); nl()
end;
function promptForInteger(prompt: string) : integer;
begin
writeString(prompt);
result := readInteger();
writeString('You typed: ');
writeInteger(result);
nl();
return
end;
(* Here you can see some useless lines.
** Just for testing the multi-line comments ...
*)
begin
k := promptForInteger('Type a number: ');
i := promptForInteger('Type another number: ');
compute(k,i) (* Here you can see some dummy comments! *)
end.