SHARE
TWEET

Untitled

a guest Feb 27th, 2020 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unit Unit13;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, StdCtrls, Grids;
  8.  
  9. type
  10.   TForm13 = class(TForm)
  11.     SG1: TStringGrid;
  12.     kolstrok: TLabel;
  13.     Label2: TLabel;
  14.     Edit1: TEdit;
  15.     Edit2: TEdit;
  16.     Button1: TButton;
  17.     Edit3: TEdit;
  18.     Button2: TButton;
  19.     Button3: TButton;
  20.     Button4: TButton;
  21.     procedure Button1Click(Sender: TObject);
  22.     procedure Button2Click(Sender: TObject);
  23.     procedure Button3Click(Sender: TObject);
  24.     procedure Edit1Change(Sender: TObject; var Key: Char);
  25.     procedure Edit2Change(Sender: TObject; var Key: Char);
  26.     procedure Edit3Change(Sender: TObject; var Key: Char);
  27.     procedure Button4Click(Sender: TObject);
  28.   private
  29.     { Private declarations }
  30.   public
  31.     { Public declarations }
  32.   end;
  33.  
  34. var
  35.   Form13: TForm13;
  36.   n,m,i,j,code:integer;
  37. a,b:real;
  38. x:array[1..60,1..60] of real;
  39. xs:array[1..60] of real;
  40. implementation
  41.  
  42. {$R *.dfm}
  43.  
  44. procedure TForm13.Button1Click(Sender: TObject);
  45. begin
  46. val(edit1.Text,n,code);
  47. val(edit2.Text,m,code);
  48. SG1.RowCount:=n+1;
  49. j:=1;
  50. SG1.ColCount:=m;
  51. i:=1;
  52. edit3.SetFocus;
  53. end;
  54.  
  55. procedure TForm13.Button2Click(Sender: TObject);
  56. begin
  57.   val(Edit3.text,x[j][i],code);
  58. SG1.Cells[j-1,i-1]:=Edit3.text;
  59. i:=i+1;
  60. if(i > n) then
  61. begin
  62. i:=1;
  63. j:=j+1;
  64. end;
  65. if j > m then
  66. begin
  67. j:=1;
  68. i:=1;
  69. end;
  70. edit3.SetFocus;
  71. end;
  72.  
  73. procedure TForm13.Button3Click(Sender: TObject);
  74. var s:string;
  75. begin
  76.    for j:=1 to m do
  77. begin
  78. xs[j]:=0.;
  79. for i:=1 to n do xs[j]:=xs[j]+x[j][i];
  80. xs[j]:=xs[j]/n;
  81. str(xs[j]:8:3,s);
  82. SG1.Cells[j-1,n]:=s;
  83. end;
  84. end;
  85.  
  86. procedure TForm13.Button4Click(Sender: TObject);
  87. begin
  88.   val(Edit3.text,x[j][i],code);
  89. SG1.Cells[j-1,i-1]:='';
  90. i:=i+1;
  91. if(i > n) then
  92. begin
  93. i:=1;
  94. j:=j+1;
  95. end;
  96. if j > m then
  97. begin
  98. j:=1;
  99. i:=1;
  100. //for i := 0 to strtoint(Edit3.Text) - do
  101.  
  102. end;
  103. edit3.SetFocus;
  104. end;
  105.  
  106. procedure TForm13.Edit1Change(Sender: TObject; var Key: Char);
  107. begin
  108.    case key of '0'..'9','-',chr(8):;
  109. '.': if pos('.',edit1.text)<>0 then key:=chr(0);
  110. chr(13): edit2.SetFocus;
  111. else key:=chr(0)
  112.    end;
  113. end;
  114.  
  115. procedure TForm13.Edit2Change(Sender: TObject; var Key: Char);
  116. begin
  117.    case key of '0'..'9','-',chr(8):;
  118. '.': if pos('.',edit2.text)<>0 then key:=chr(0);
  119. chr(13): edit2.SetFocus;
  120. else key:=chr(0) end;
  121. end;
  122.  
  123. procedure TForm13.Edit3Change(Sender: TObject; var Key: Char);
  124. begin
  125.    case key of '0'..'9','-',chr(8):;
  126. '.': if pos('.',edit3.text)<>0 then key:=chr(0);
  127. chr(13): edit3.SetFocus;
  128. else key:=chr(0) end;
  129. end;
  130.  
  131. end.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top