fastcall Tform1::Tform1(Tcomponent* Owner)
bet 38/41 Sana 04.02.2022 Hajmi 1,16 Mb. #428241
Bog'liq
Sohaga oid strukturaviy toifadagi masalalarni Borland C Builder 6 da amalga oshirish. Dasturlarga strukturaviy yondashgan xolda murakkab dasturlar yaratish uslubiyatini amalga oshirish (protseduradan foydalanish).
__fastcall Tform1::Tform1(Tcomponent* Owner)
: Tform(Owner)
{
}
//----------------------------------------------------------------------
int sum=0;
void __fastcall Tform1::Button1Click(Tobject *Sender)
{ int I,j, a[4][4];
randomize();
for(i=0;i<4;i++)
for(j=0;j<4;j++)
{ a[i][j]=random(10);
StringGrid1->Cells[i][j]=IntToStr(a[i][j]);
sum+=a[i][j];}
}
//-------------------------------------------------------------------
void _fastcall Tform1::Button2Click(Tobject *Sender)
{
Label1->Caption=” Yigindi=” +IntToStr(sum);
}
//--------------------------------------------------------------------
Dasturda Button1 massivni tasodifiy sonlar bilan to‘ldirish uchun ishlatilgan. Button2 natijani formaga chiqarish uchun ishlatilgan. Olingan natija(7-rasm):
Forma ilovasida olingan natijalar
Do'stlaringiz bilan baham: