1-Ma’ruza: Dasturlash tillari faniga kirish Reja


Download 436.03 Kb.
bet52/62
Sana04.02.2023
Hajmi436.03 Kb.
#1164753
1   ...   48   49   50   51   52   53   54   55   ...   62
Bog'liq
1-Ma’ruza Dasturlash tillari faniga kirish Reja

Dinamik ro’yxat. Quyidagi dastur talaba familiyasini ro’yxat boshiga qo’shib, talabalar ro’yxatini hosil qiladi. Ma'lumotlar tahrirlash komponеntasiga kiritilib, Qo’shish (button1) tugmasini bosib, ro’yxatga kiritiladi. Kiritilgan elеmеntlar ro’yxati Ro’yxat (button2) tugmasini bosib, alohida oynada chiqariladi. Elеmеntni ro’yxatdan o’chirish uchun Ro’yxat (button3) o’chirish tugmasi bosiladi.



Loyiha kodi quyidagi ko’rinishda bo’ladi:




unit Unit3;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label2: TLabel;
Edit1: TEdit;
Label3: TLabel;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var Form1: TForm1;
implementation
{$R *.DFM}
type
TPStudent=^TStudent;
TStudent = record
f_name:string[20];
l_name: string[20];
next: TPStudent;
end;
var
head: TPStudent; // начало (голова) списка
procedure TForm1.Button1Click(Sender: TObject);
var
curr: TPStudent;
begin
new(curr); curr^.f_name := Edit1.Text; curr^.l_name := Edit2.Text; curr^.next:= head; head := curr; Edit1.text:=''; Edit2.text:= '';
end;
procedure TForm1.Button2Click(Sender: TObject);
var curr: TPStudent; n:integer; st:string;

Download 436.03 Kb.

Do'stlaringiz bilan baham:
1   ...   48   49   50   51   52   53   54   55   ...   62




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling