«Aniq fanlar» kafedrasi fanidan ma’ruzalar matni


Download 1.15 Mb.
bet39/161
Sana02.01.2022
Hajmi1.15 Mb.
#200874
1   ...   35   36   37   38   39   40   41   42   ...   161
Bog'liq
dasturlash fanidan maruzalar matni 2

n->next = w->next;

w->next = n;

n->Data = data;

return n;

}

List* del(List* w) // Ro‘yxatdan elementni o‘chirish

{

if(w->prev){w->prev->next = w->next;}

if(w->next){w->next->prev = w->prev;}

List * r;

if(w->next) {r = w->next;} else {r = w->prev;}

delete w;

return r;

}

List First; // Ro‘yxatning boshi

List* Last = &First; // Ro‘yxatning oxiri

//---------------------------------------------------------------------------

__fastcall TForm1::TForm1(TComponent* Owner)

: TForm(Owner)

{

}

//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)

{

Memo1->Lines->Clear();

List* m = &First;

while(m)

{

Memo1->Lines->Add(m->Data);

m = m->next;

}

}

//---------------------------------------------------------------------------

void __fastcall TForm1::Button2Click(TObject *Sender)

{

Last = add(Last,Edit1->Text);

Edit1->Text = "";

}

//---------------------------------------------------------------------------

void __fastcall TForm1::Button3Click(TObject *Sender)

{

Last = del(Last);

}

//---------------------------------------------------------------------------


Download 1.15 Mb.

Do'stlaringiz bilan baham:
1   ...   35   36   37   38   39   40   41   42   ...   161




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