Var R,A:real; S:string; i,z,L:integer; Begin Read(S); S:=' '+S; L:=Length(S); i:=1; R:=0; Repeat Case S[i] of '0'..'9': Begin A:=0; if S[i-1]='-' then z:=1 else z:=0; While (S[i]in['0'..'9'])and(i<L) do Begin A:=A*10+StrToInt(S[i]); i:=i+1 End; if (i=L)and(S[i]in['0'..'9']) then A:=A*10+StrToInt(S[i]); if z=0 then R:=R+A else R:=R-A; End; End; i:=i+1 Until i>L; WriteLn('Сумма чисел в строке: ',R) End.
Var A,R:real; i,L,z:integer; S:string; Begin Read(S); L:=Length(S); i:=1; R:=0; While (S[i]in['0'..'9'])and(i<L) do Begin R:=R*10+StrToInt(S[i]); i:=i+1 End; While i<L do Begin Case S[i] of '+':z:=0; '-':z:=1; '*':z:=2; '/':z:=3; End; i:=i+1; A:=0; While (S[i]in['0'..'9'])and(i<L) do Begin A:=A*10+StrToInt(S[i]); i:=i+1 End; if i=L then A:=A*10+StrToInt(S[L]); Case z of 0:R:=R+A; 1:R:=R-A; 2:R:=R*A; 3:R:=R/A; End; End; WriteLn('R = ',R); End.
R,A:real;
S:string;
i,z,L:integer;
Begin
Read(S);
S:=' '+S;
L:=Length(S);
i:=1;
R:=0;
Repeat
Case S[i] of
'0'..'9':
Begin
A:=0;
if S[i-1]='-' then z:=1
else z:=0;
While (S[i]in['0'..'9'])and(i<L) do
Begin
A:=A*10+StrToInt(S[i]);
i:=i+1
End;
if (i=L)and(S[i]in['0'..'9']) then A:=A*10+StrToInt(S[i]);
if z=0 then R:=R+A
else R:=R-A;
End;
End;
i:=i+1
Until i>L;
WriteLn('Сумма чисел в строке: ',R)
End.