【实践】delphi简易成绩表
二维数组的实践结果,delphi中比较容易搞混数组的下标是行还是列。unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, StdCtrls;
type
TForm1 = class(TForm)
strngrdtable1: TStringGrid;
btn1: TButton;
procedure FormCreate(Sender: TObject);
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
strngrdtable1.Cells:= '小明';
strngrdtable1.Cells:= '小红';
strngrdtable1.Cells:= '语文';
strngrdtable1.Cells:= '数学';
strngrdtable1.Cells:= '英语';
strngrdtable1.Cells:= '总成绩';
end;
procedure TForm1.btn1Click(Sender: TObject);
var
i,j: Integer;
cjb: array of array of Integer;
begin
for i:= 1 to 2 do
begin
cjb:= 0;
begin
for j:= 1 to 3 do
begin
cjb:= StrToInt(strngrdtable1.Cells);
cjb:= cjb + cjb;
end;
end;
end;
strngrdtable1.Cells:= IntToStr(cjb);
strngrdtable1.Cells:= IntToStr(cjb);
end;
end.
各位网友求指点,成绩表内容居中如何搞?
页:
[1]