Код:
program qwer;
var
s:string;
a:char;
infile,outfile:text;
n,m,c,i:integer;
begin
assign(infile,'input.txt');
assign(outfile,'output.txt');
reset(infile);
rewrite(outfile);
repeat
readln(infile,s);
for i:=1 to length(s) do begin
a:=s[i];
case a of
'+':begin
val(Copy(s,1, i-1),m,c);
val(Copy(s,i+1,length(s)-i),n,c);
write(outfile,s+'=');
writeln(outfile,m+n);
end;
'-':begin
val(Copy(s,1, i-1),m,c);
val(Copy(s,i+1,length(s)-i),n,c);
write(outfile,s+'=');
writeln(outfile,m-n);
end ;
'*':begin
val(Copy(s,1, i-1),m,c);
val(Copy(s,i+1,length(s)-i),n,c);
write(outfile,s+'=');
writeln(outfile,m*n);
end ;
'/':begin
val(Copy(s,1, i-1),m,c);
val(Copy(s,i+1,length(s)-i),n,c);
write(outfile,s+'=');
writeln(outfile,m/n:8:2);
end ;
end;
end;
n:=0;
m:=0;
until eof(infile);
close(outfile);
close(infile);
end.