решите номер 5 пункт: б) в) г) Задачи по теме 'Процедуры'
Answers & Comments
APALoff
Const Mmax = 100; Type tMas = array[1..Mmax] of Real; Var S : String; M : tMas; i : Byte;
Procedure DelCh(Ch : Char; Var S : String); Begin While Pos(Ch,S)>0 do Delete(S,Pos(Ch,S),1); end;
Procedure Obram(Var S : String); Begin S:='#'+S+'#' end;
Procedure Sort(Var T : tMas); Var i,j : Byte; A : Real; Begin For i:=1 to Mmax-1 do For j:=i+1 to Mmax do If T[j]<T[i] then Begin A:=T[j]; T[j]:=T[i]; T[i]:=A; end; end;
Begin S:='AAATESTAAA'; DelCh('A',S); Writeln(S);
Obram(S); Writeln(S);
Writeln; For i:=1 to Mmax do M[i]:=Random(100); Sort(M); For i:=1 to Mmax do Writeln(M[i]); end.
Answers & Comments
Type tMas = array[1..Mmax] of Real;
Var
S : String;
M : tMas;
i : Byte;
Procedure DelCh(Ch : Char; Var S : String);
Begin
While Pos(Ch,S)>0 do Delete(S,Pos(Ch,S),1);
end;
Procedure Obram(Var S : String);
Begin
S:='#'+S+'#'
end;
Procedure Sort(Var T : tMas);
Var i,j : Byte;
A : Real;
Begin
For i:=1 to Mmax-1 do
For j:=i+1 to Mmax do
If T[j]<T[i] then
Begin
A:=T[j];
T[j]:=T[i];
T[i]:=A;
end;
end;
Begin
S:='AAATESTAAA';
DelCh('A',S);
Writeln(S);
Obram(S);
Writeln(S);
Writeln;
For i:=1 to Mmax do M[i]:=Random(100);
Sort(M);
For i:=1 to Mmax do Writeln(M[i]);
end.