This repository has been archived by the owner on Sep 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.input.txt
90 lines (81 loc) · 1.59 KB
/
test.input.txt
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
"""
Control Test
PLD 17/18
"""
# Global variables
integer:int;
character:char;
real:double;
MATRIXSIZE:int;
matrix:[10][10]int;
# Functions
def setValue(row:int, column:int, value:int):void {
if (row >= 0 && row < MATRIXSIZE && column >= 0 && column < MATRIXSIZE): {
matrix[row][column] = value;
}
}
def getValue(row:int, columnn:int):int {
if (row < 0 || row >= MATRIXSIZE) || (columnn < 0 && columnn >= MATRIXSIZE): {
return -1;
}
else {
return matrix[row][columnn];
}
}
def fill(value:int):void {
i,j:int; # Multiple variable definition
i = 0;
while i < MATRIXSIZE: {
j = 0;
while j < MATRIXSIZE: {
setValue(i,j, value);
j = j + 1;
}
i = i + 1;
}
}
def show():void {
i,j:int;
i = 0;
print '[','\n';
while i < MATRIXSIZE: {
j = 0;
print '\t','[';
while j < MATRIXSIZE: {
print getValue(i,j);
if j != MATRIXSIZE - 1: {
print ',';
}
j = j + 1;
}
print ']','\n';
i = i + 1;
}
print ']';
}
# Record
date:struct {
day, mounth, year:int;
};
# Main program
#def no_main ():void{ # Uncomment to test
def main():void { # Uncomment to test
characters:[1][2][3]char;
MATRIXSIZE = 10;
fill(1);
setValue(5,5,5);
integer = getValue(5,5);
if integer == 5: # Uncomment { to test
print 'O','k','\n';
else {
print 'E','r','r','o','r','\n';
}
show();
date.day = 9;
date.mounth = 3;
date.year = 2016;
character = (char)date.day;
real = 4.5 + 4. * 3e+3 - 5.4E-3;
#error:int; # Uncomment to test
}
#def no_function():void {} # Uncomment to test