Составить программу на ! пользователь вводит два числа. если они не равны 10 и первое число четное, то вывести их сумму, иначе вывести их произведение.
Program zadacha;vara,b,sum,pr:integer;beginwriteln('vvedite dva chisla');readln(a,b);if (a<>10) and (b<>10) and (a mod 2 = 0)thenwriteln('a+b=',a+b)elsewriteln('a*b=',a*b);end.
BorgovichOA
16.10.2022
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 у меня сейчас нет, так что проверяйте сами. Если что не так - сообщайте.
Aleksandr-Andrei
16.10.2022
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 у меня сейчас нет, так что проверяйте сами. Если что не так - сообщайте.