![]() Главная страница Случайная страница КАТЕГОРИИ: АвтомобилиАстрономияБиологияГеографияДом и садДругие языкиДругоеИнформатикаИсторияКультураЛитератураЛогикаМатематикаМедицинаМеталлургияМеханикаОбразованиеОхрана трудаПедагогикаПолитикаПравоПсихологияРелигияРиторикаСоциологияСпортСтроительствоТехнологияТуризмФизикаФилософияФинансыХимияЧерчениеЭкологияЭкономикаЭлектроника |
Procedure ReCalculation;
public { Public declarations } end;
implementation
{$R *.dfm}
Procedure TForm1.ReCalculation; Var I, J, N, M, A, B, C: Integer; Begin N: =StrToInt(Edit1.Text); M: =StrToInt(Edit2.Text); for I: =1 To N do for J: =1 To M Do Try A: = StrToInt(StringGrid1.Cells[J, I]); B: = StrToInt(StringGrid2.Cells[J, I]); C: =A+B; StringGrid3.Cells[J, I]: =IntToStr(C) Except Beep; StringGrid3.Cells[J, I]: ='? '; End; End;
procedure TForm1.Button1Click(Sender: TObject); begin Close; end;
procedure TForm1.FormCreate(Sender: TObject); begin StringGrid1.Cells[0, 1]: ='1'; StringGrid1.Cells[1, 0]: ='1'; StringGrid1.Cells[1, 1]: ='0'; StringGrid2.Cells[0, 1]: ='1'; StringGrid2.Cells[1, 0]: ='1'; StringGrid2.Cells[1, 1]: ='0'; StringGrid3.Cells[0, 1]: ='1'; StringGrid3.Cells[1, 0]: ='1'; StringGrid3.Cells[1, 1]: ='0' end;
procedure TForm1.Edit1Change(Sender: TObject); Var J, N, M: Integer; Begin M: =StrToInt(Edit2.Text); N: =StrToInt(Edit1.Text); StringGrid1.RowCount: =N+1; StringGrid2.RowCount: =N+1; StringGrid3.RowCount: =N+1; StringGrid1.Cells[0, N]: =Edit1.Text; StringGrid2.Cells[0, N]: =Edit1.Text; StringGrid3.Cells[0, N]: =Edit1.Text; for J: =1 to M do Begin If StringGrid1.Cells[J, N]='' then StringGrid1.Cells[J, N]: ='0'; If StringGrid2.Cells[J, N]='' then StringGrid2.Cells[J, N]: ='0'; End; ReCalculation End;
procedure TForm1.Edit2Change(Sender: TObject); Var I, N, M: Integer; begin M: = StrToInt(Edit2.Text); N: =StrToInt(Edit1.Text); StringGrid1.ColCount: =M+1; StringGrid2.ColCount: =M+1; StringGrid3.ColCount: =M+1; StringGrid1.Cells[M, 0]: =Edit2.Text; StringGrid2.Cells[M, 0]: =Edit2.Text; StringGrid3.Cells[M, 0]: =Edit2.Text; for I: =1 to N do Begin If StringGrid1.Cells[M, I]='' then StringGrid1.Cells[M, I]: ='0'; If StringGrid2.Cells[M, I]='' then StringGrid2.Cells[M, I]: ='0'; End;
|