Program primer; const n=100; var a:array[1..n] of integer; i,max:integer; begin writeln('vvedite massiv'); for i:=1 to n do readln(' ', a[i]); max:=a[1]; for i :=1 to n do if (a[i]>a[1]) and (a[i]>0) then max:=a[i]; writeln('max=',max); readln; end.
Procedure TForm1.Button4Click(Sender: TObject); var Buff: TNodePointer; x: TItem; i,j: Cardinal; begin i:=0; Buff:=Head; if(Buff^.Next=nil) then begin ShowMessage('В стеке один элемент!'); exit; end; while Buff <> nil do begin while (Buff^.Next<>nil) and (Buff^.Data=Buff^.Next^.Data) and not(isEmpty(Buff)) do begin pop(Buff^.Next,x); for j:=i to StringGrid1.RowCount-2 do StringGrid1.Cells[0,j]:=StringGrid1.Cells[0,j+1]; StringGrid1.RowCount:=StringGrid1.RowCount-1; end; Buff:=Buff^.Next; i:=i+1; end; end;
PS. Delphi у меня сейчас нет, так что проверяйте сами. Если что не так - сообщайте.
Procedure TForm1.Button4Click(Sender: TObject); var Buff: TNodePointer; x: TItem; i,j: Cardinal; begin i:=0; Buff:=Head; if(Buff^.Next=nil) then begin ShowMessage('В стеке один элемент!'); exit; end; while Buff <> nil do begin while (Buff^.Next<>nil) and (Buff^.Data=Buff^.Next^.Data) and not(isEmpty(Buff)) do begin pop(Buff^.Next,x); for j:=i to StringGrid1.RowCount-2 do StringGrid1.Cells[0,j]:=StringGrid1.Cells[0,j+1]; StringGrid1.RowCount:=StringGrid1.RowCount-1; end; Buff:=Buff^.Next; i:=i+1; end; end;
PS. Delphi у меня сейчас нет, так что проверяйте сами. Если что не так - сообщайте.
const n=100;
var a:array[1..n] of integer;
i,max:integer;
begin
writeln('vvedite massiv');
for i:=1 to n do
readln(' ', a[i]);
max:=a[1];
for i :=1 to n do
if (a[i]>a[1]) and (a[i]>0) then max:=a[i];
writeln('max=',max);
readln;
end.