Расположить на форме компонент Вкладки и расположить на них 3 таблицы- одну с исходными данными о студенте: ФИО, отделение, курс, стипендия. А во вторую выбирать студентов курса, указанного в окне Edit, в третью выбрать тех студентов, которые получают стипендию на втором курсе .
unit Unit1;
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Math;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
SG1.Cells[0,0]:='ÔÈÎ';
SG1.Cells[1,0]:='Îòäåëåíèå';
SG1.Cells[2,0]:='Êóðñ';
SG1.Cells[3,0]:='Ñòèïåíäèÿ';
SG2.Cells[0,0]:='ÔÈÎ';
SG2.Cells[1,0]:='Îòäåëåíèå';
SG2.Cells[2,0]:='Ñòèïåíäèÿ';
SG3.Cells[0,0]:='ÔÈÎ';
SG3.Cells[1,0]:='Îòäåëåíèå';
SG3.Cells[2,0]:='Êóðñ';
end;
procedure TForm1.Button2Click(Sender: TObject);
var j,i:byte;
begin
for j:=0 to sg1.colcount-1 do
for i:=1 to sg1.rowcount-1 do
SG1.Cells[j,i]:='';
for j:=0 to sg2.colcount-1 do
for i:=1 to sg2.rowcount-1 do
SG2.Cells[j,i]:='';
for j:=0 to sg3.colcount-1 do
for i:=1 to sg3.rowcount-1 do
SG3.Cells[j,i]:='';
E1.Text:='';
E2.Text:='';
end;
procedure TForm1.Button3Click(Sender: TObject);
VAR i,j,m,n,K,K1:byte;
begin
K:=1;
for i:=1 to SG1.RowCount-1 do
if SG1.Cells[2,i]=E1.Text then begin
SG2.Cells[0,K]:=SG1.Cells[0,i];
SG2.Cells[1,K]:=SG1.Cells[1,i];
SG2.Cells[2,K]:=SG1.Cells[3,i];INC(K);
end;
K1:=1;
for i:=1 to SG1.RowCount-1 do
if SG1.Cells[3,i]=E2.Text then begin
SG3.Cells[0,K1]:=SG1.Cells[0,i];
SG3.Cells[1,K1]:=SG1.Cells[1,i];
SG3.Cells[2,K1]:=SG1.Cells[2,i];INC(K1);
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
var i,j,n,m:byte; f:textfile;k,t:string;
begin
if savedialog1.execute=true then
begin
k:=savedialog1.FileName;
assignfile(f,k);
rewrite(f);
writeln(f,SG1.rowcount);
writeln(f,SG1.colcount);
for i:=0 to SG1.rowcount-1 do
for j:=0 to SG1.colcount-1 do
writeln(f,SG1.Cells[j,i]);
closefile(f);
end;
end;
procedure TForm1.Button5Click(Sender: TObject);
var i,j,n,m:integer; f:textfile;k,t:string;
begin
if opendialog1.execute=true then
begin
k:=opendialog1.FileName;
assignfile(f,k);
reset(f);
readln(f,n);
SG1.Rowcount:=n;
readln(f,m);
SG1.ColCount:=m;
for i:=0 to n-1 do
for j:=0 to m-1 do begin
readln(f,k);
SG1.Cells[j,i]:=k;
end;
closefile(f);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
close;
end;
end.