Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MODULE drugi;
- FROM stek IMport Stack,makenull,empty,pop,push,top;
- FROM FIO IMPORT Open,close,file,eof,rdint,wrint,wrstr,wrln,rdcard,ok,rdchar,wrcard;
- from inout import writestring,writeln;
- from infotip import infotip;
- VAr
- s1,s2:Stack;
- x,y,z: infotip;
- f:file;
- c:char;
- ok:boolean;
- begin
- f:=open('br.txt');
- eof:=false;
- while not eof do
- x:=rdcard(f);
- push(s1,x,ok);
- x:=rdcard(f);
- Push(s2,x,ok);
- end;
- close(f);
- f:=create(.prvi.txt');
- While not Empty(s1) do
- top(s1,x,ok);
- pop(s1,ok);
- IF not odd(x) Do
- wrcard(f,x,1);
- wrln(f);
- end;
- end;
- close(f);
- f:=Create('drugi.txt');
- top(s2,x,ok);
- pop(s2,ok);
- top(s2,y,ok);
- pop(s2,ok);
- top(s2,z,ok);
- pop(s2,ok);
- WHILe not empty(s2) DO
- IF x>y THE
- wrcard(f,x,2);
- wrln(f);
- pop(s2,ok);
- ELSE
- pop(s2,ok);
- end;
- top(s2,x,ok);
- pop(s2,ok);
- top(s2,y,ok);
- IF ok then
- pop(s2,ok);
- push(s2,y,ok);
- push(s2,x,ok);
- ELSE
- wrcard(f,x,2);
- wrln(f);
- end;
- end;
- CLOSE(f);
- END drugi.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement