Вопрос задан 24.09.2023 в 16:29. Предмет Информатика. Спрашивает Нескоромный Ярик.

ЗАПОВНІТЬ ПРОПУЩЕНІ ФРАГМЕНТИ: procedure TForm1.Button1Click(Sender: TObject); var: array [] of

real; i,n: integer; max,min: ; begin n: Memo1.Lines.Count; for i:=0 to n-1 do a[i]: StrToFloat( ; max:=_ D); min:__________; for i:=_ if a[i]>_ if a[i]< Edit1. :-FloatToStr(______); Edit2. to n-1 do then then min:=______; else (min);​
0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Лодди Денис.

Відповідь:

procedure TForm1.Button1Click(Sender: TObject);

var a: array [] of real;

i,n: integer;

max,min: real;

begin

n:= Memo1.Lines.Count;

for i:=0 to n-1 do

a[i]:= StrToFloat(Memo1.Lines[i]);

max:= a[0];

min:= a[0];

for i:= 1 to n-1 do

if a[i]>max then max:= a[i];

else if a[i]<min then min:= a[i];

Edit1.Text:= FloatToStr(max);

Edit2.Text:= FloatToStr(min);

end;

Пояснення:

0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Based on the provided code, it seems like you're writing a procedure in Delphi (Object Pascal) to perform some operations on an array of real numbers. However, there are some missing parts in the code you provided. I'll help you fill in the blanks:

pascal
procedure TForm1.Button1Click(Sender: TObject); var a: array of real; // Declare array of real i, n: integer; max, min: real; // Declare max and min as real numbers begin n := Memo1.Lines.Count; // Get the number of lines in Memo1 // Initialize the array length SetLength(a, n); // Fill the array with values from Memo1 for i := 0 to n - 1 do a[i] := StrToFloat(Memo1.Lines[i]); max := a[0]; // Initialize max with the first element of the array min := a[0]; // Initialize min with the first element of the array for i := 0 to n - 1 do begin if a[i] > max then max := a[i]; if a[i] < min then min := a[i]; end; Edit1.Text := FloatToStr(max); // Convert max to string and assign to Edit1 Edit2.Text := FloatToStr(min); // Convert min to string and assign to Edit2 end;

Explanation:

  1. SetLength(a, n);: This line initializes the dynamic array a with a length of n.

  2. a[i] := StrToFloat(Memo1.Lines[i]);: This line converts the string from Memo1.Lines[i] to a real number using StrToFloat and assigns it to the corresponding element of the array a.

  3. max := a[0]; and min := a[0];: These lines initialize max and min with the first element of the array a.

  4. The loop for i := 0 to n - 1 do iterates through the elements of the array and updates max and min accordingly.

  5. Edit1.Text := FloatToStr(max); and Edit2.Text := FloatToStr(min);: These lines convert max and min to strings using FloatToStr and assign them to Edit1 and Edit2 respectively.

Please note that this code assumes that Memo1, Edit1, and Edit2 are components available in your Delphi form. Make sure to declare and initialize them appropriately in your form.

0 0

Похожие вопросы

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос