52 lines
1.1 KiB
Plaintext
52 lines
1.1 KiB
Plaintext
BACI System: C-- to PCODE Compiler in C, 11:30 1 Oct 2012
|
|
Source file: zad2.cm Mon Dec 3 16:27:21 2018
|
|
line pc
|
|
1 0 monitor m{
|
|
2 0 condition c;
|
|
3 0 int ile;
|
|
4 0 int liczba1;
|
|
5 0 int liczba2;
|
|
6 0
|
|
7 0 void gen1(int n){
|
|
8 1 liczba1=n;
|
|
9 4 ile=ile+1;
|
|
10 9 if(ile==2) signalc(c);
|
|
11 15 }
|
|
12 17
|
|
13 17 void gen2(int n){
|
|
14 18 liczba2=n;
|
|
15 21 ile=ile+1;
|
|
16 26 if(ile==2) signalc(c);
|
|
17 32 }
|
|
18 34
|
|
19 34 int getSuma(){
|
|
20 35 if(ile < 2) waitc(c);
|
|
21 42 return liczba1+liczba2;
|
|
22 48 }
|
|
23 50
|
|
24 50 init{
|
|
25 50 liczba1=0;
|
|
26 53 liczba2=0;
|
|
27 56 ile=0;
|
|
28 59 }
|
|
29 60 }
|
|
30 60
|
|
31 60
|
|
32 60 void a(){
|
|
33 60 gen1(10);
|
|
34 64 }
|
|
35 65
|
|
36 65 void b(){
|
|
37 65 gen2(15);
|
|
38 69 }
|
|
39 70
|
|
40 70 void c(){
|
|
41 70 cout << getSuma() <<endl;
|
|
42 75 }
|
|
43 76
|
|
44 76 main(){
|
|
45 77 cobegin{
|
|
46 78 a(); b(); c();
|
|
47 87 }
|
|
48 88 }
|