-
Notifications
You must be signed in to change notification settings - Fork 0
/
input-lab13.txt
68 lines (54 loc) · 938 Bytes
/
input-lab13.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
// * Global variables
int i,n,j;
char c;
struct {
int integer;
char character;
} pair;
// * Functions
void p() {}
int f(double r, int e) {
double real;
char c;
real = (double)(pair.character)+(double)(pair.integer)+r+(double)e;
c='0';
return (int)c;
}
int[10][10] matrix;
void fill(int row, int value, int increment) {
int i,inc;
i=0;
inc=increment;
while (i<10) {
matrix[row][i]=value+inc;
i=i+1;
inc=inc+increment;
}
}
void show(int row) {
int i;
i=0;
while (i<10) {
write '(', row, ',', i, ')', ':', matrix[row][i], ' ';
i=i+1;
}
write '\n';
}
// * Main program
void main() {
int i;
p(); // * Invocation (procedure) as statement
i=0;
pair.character='0';
pair.integer=(int)'0';
write f((double)i,(int)(pair.character)), '\n'; // Invocation as expression
f(1.3, 2); // * Invocation (function) as statement
i=0;
j=0;
while (i<10) {
fill(i, j, 1);
show(i);
i=i+1;
j=i*10;
}
}