var s : string[50]; i, j, k : word; f : boolean; function isSpace(ch : char) : boolean; begin isSpace := false; if ch = ' ' then isSpace := true; end; begin f := false; repeat j := 0; writeln('введите строку, состоящую из 2 слов'); readln(s); for i := 1 to length(s) do if isSpace(s[i]) then begin inc(j); k := i; end; if j =1 then f := true; until f; write(copy(s, k + 1, length(s)), ' ', copy(s, 1, k - 1)); end. недавно такую писала :)
i, j, k : word;
f : boolean;
function isSpace(ch : char) : boolean;
begin isSpace := false;
if ch = ' ' then isSpace := true;
end;
begin f := false;
repeat j := 0;
writeln('введите строку, состоящую из 2 слов');
readln(s);
for i := 1 to length(s) do
if isSpace(s[i]) then
begin
inc(j);
k := i; end;
if j =1 then f := true;
until f;
write(copy(s, k + 1, length(s)), ' ', copy(s, 1, k - 1));
end.
недавно такую писала :)
const
handsfree = false;
nmax = 10;
random_min = -50;
random_max = 50;
var
a: array[0..nmax] of real;
i, n: integer;
sum, x: real;
begin
{ввод массива}
n := nmax;
if handsfree then begin
for i := 0 to n do
begin
a[i] := random(random_max - random_min) + random_min;
write(a[i], ' ');
end
end
else begin
for i := 0 to n do
readln(a[i]);
end;
writeln();
{подсчет суммы}
write('x = ');
readln(x);
sum := a[n];
for i := n - 1 downto 0 do
sum := sum * x + a[i];
writeln('S = ', sqrt(sum));
end.