-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinput.txt
45 lines (44 loc) · 923 Bytes
/
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
/* === sample 9 ==== */
int x[10];
int minloc ( int a[], int low, int high )
{int i; int x; int k;
k = low;
x = a[low];
i = low + 1;
if (i < high) {
repeat
{ if (a[i] < x)
{ x= a[i];
k = i; } else { } endif
i = i + 1;
} until (high < i + 1)
} endif
return k;
}
void sort( int a[], int low, int high) {
int i;
int k;
int t;
i = low;
if (i < high - 1) {
repeat {
k = minloc(a,i,high);
t = a[k];
a[k] = a[i];
a[i] = t;
i = i+1;
} until (high - 2 < i)
} endif
}
void main(void)
{ int i;
i = 0;
repeat
{ x[i] = i * i;
i = i + 1; } until (9 < i)
sort(x,0,10);
i = 0;
repeat
{ output(x[i]);
i = i + 1;} until (9 < i)
}