program project1 mode objfpc uses IFDEF UNIX IFDEF UseCThreads cthread

 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
program project1;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes
{ you can add units after this };
var t:text;
a:array[1..6]of char;
b,c,e,f,j:integer;
begin
assign(t,'input.txt');
reset(t);
b:=1;
a[6]:='k';
while not eof(t) do begin
read(t,a[b]);
b:=b+1;
end;
if a[6] <> 'k' then begin
j:=1;
end;
if a[1] = 'x' then begin
e:=ord(a[3])-48;
f:=ord(a[5])-48;
if a[2] = '+' then begin
c:=f - e;
end;
if a[2] = '-' then begin
c:=f + e;
end;
end
else begin
e:=ord(a[1]) - 48;
f:=ord(a[5]) - 48;
if a[2] = '+' then begin
c:=f - e;
end;
if a[2] = '-' then begin
c:=f + e;
end;
end;
close(t);
assign(t,'output.txt');
rewrite(t);
if j = 1 then begin
write(t,'not to be enter');
end
else begin
write(t,c);
end;
close(t);
end.