Ә ұқ
C++Builder , ұ үң қ ң ү ғ (, ) қ. ұ ғң қ Standart ң CheckBox, RadioButton ә RadioGroup қ. ғ ү ғ : қғ (ν ●) ә ғ (□ ○). ғ ү қ қ ө: ә ә ө ә. ә ғң ұ қ ғғ , ә .
CheckBox . CheckBox ң ө ғ, ә ғ . Ә, қ ғ ғ ғ қ , ү ң қ GroupBox ә Panel ә .. қ.
Ә қ ғң ү ө ү қң қ , ғ қ ғ қ ә ү ө , CheckBox ү ү OnClick қғ . ұ қғ өң ғ , ө ғң ү әң ң қ ү қ.
,
void __fastcall TForm1::CheckBox1Click(TObject *Sender)
{
if (CheckBox1->Checked = = true)
Memo1->Font->Size=10;
}
RadioButton .RadioButton ә ғ қ , ғ, қ RadioButton ү ғң қғ ү , қғң ғ ү ғ ү ө.
ғ ұ
1-ғ. қ (random) ғ ң max ә min ә ұ қң ұ - ә қ құң. /4.8-/
4.8-. Қ .
#include "Unit1.h"
#include "stdlib.h"
TForm1 *Form1;
float a[100];
int Elem_sani=0;
//---------------------------------------------------------------------------
|
|
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//--- ң ----------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
float max=a[0];
float min=a[0];
if (Edit1->Text=="")
{ShowMessage("Massiv elementterinin sanin beriniz");
Edit1->SetFocus();}
if (CheckBox1->Checked == True) //max
{ for (int i=0;i
if (a[i]>max) max=a[i];
}
Edit2->Text=FloatToStrF(max,ffFixed,5,2);
}
if (CheckBox2->Checked == True) //min
{ for (int i=0;i
if (a[i]
Edit3->Text=FloatToStrF(min,ffFixed,5,2);
}
if (CheckBox3->Checked == True)
// ө ұ
for (int i=0;i<elem_sani;i++)
{ max=a[i]; int Nmax=i;
for (int j=i;j<elem_sani;j++)
if (a[j]>max) {max=a[j]; Nmax=j;}
a[Nmax]=a[i]; a[i]=max;
Memo2->Lines->Add("a["+Int
ToStr(i)+"]= "+FloatToStrF(max,ffFixed,5,2)); }
}
//------ ң -----------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
if (Edit1->Text=="")
{ShowMessage("Massiv elementterinin sanin beriniz");
Edit1->SetFocus();}
Elem_sani=StrToInt (Edit1->Text);
for (int i=0; i<elem_sani;i++)
{ a[i]= (float) random(100)/7-3;
Memo1->Lines->Add("a["+IntToStr(i)+"]=
"+FloatToStrF(a[i],ffGeneral,3,1));}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormActivate(TObject *Sender)
{Edit1->SetFocus();}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{Form1->Close();}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{Memo1->Clear(); Memo2->Clear();
Edit1->Clear(); Edit2->Clear(); Edit3->Clear();}
//---------------------------------------------------------------------------
2-ғ.
ә (, ә ғ ) ү қғ. ғ ә ұ ( , ғ ) ң. 4.9- ө.
4.9-. ә
қң ә қғң ә:
ң | Қң ә, қғ |
Form1 | Caption = 'RadioButton i ' |
Label1 | Caption = '' |
Label2 | Caption = '' |
Label3 | Caption = ' ' |
Memo1 | Lines.Strings = (') |
Edit1 | Text қ , OnKeyPress = Edit1KeyPress |
Edit2 | Text қ , OnKeyPress = Edit2KeyPress |
Edit3 | Text қ , OnKeyPress = Edit3KeyPress |
Button1 | Caption = 'II ', OnClick = Button1Click |
Button2 | Caption = ' ', OnClick = Button2Click |
RadioGroup1 | Caption = '' |
Items.Strings = (' ' ' ' ' ') |
|
|
ң ә:
#include "Unit1.h"
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
class stud
{ public:
AnsiString fam, ati;
int tugG;
};
stud grup[10]; int n=0;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------</elem_sani;i++)
</elem_sani;j++)
</elem_sani;i++)
void __fastcall TForm1::Button1Click(TObject *Sender)
// 'II ' ң
{
grup[n].fam=Edit1->Text;
grup[n].ati=Edit2->Text;
grup[n].tugG=StrToInt(Edit3->Text);
Memo1->Lines->Add(grup[n].fam+" "+
grup[n].ati+" "+IntToStr(grup[n].tugG));
n++;
Edit1->Clear();Edit2->Clear();Edit3->Clear();
Edit1->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit1KeyPress(TObject *Sender,
char &Key)
{
if (Key==13) Edit2->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit2KeyPress(TObject *Sender,
char &Key)
{
if (Key==13) Edit3->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit3KeyPress(TObject *Sender,
char &Key)
{
if (Key==13) Button1->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
// ' ' ң
{
if (RadioGroup1->ItemIndex==0) //fam boinsha syriptay bastaldi
{ Memo1->Clear();
for(char i='';i<='';i++)
for (int j=0;j<n;j++)
if (grup[j].fam[1]==i)
Memo1->Lines->Add(grup[j].fam+" "+
grup[j].ati+" "+IntToStr(grup[j].tugG));
} // fam boinsha syriptay bitti
if (RadioGroup1->ItemIndex==1) //ati boinsha syriptay bastaldi
{ Memo1->Clear();
for(char i='';i<='';i++)
for (int j=0;j<n;j++)
if (grup[j].ati[1]==i)
Memo1->Lines->Add(grup[j].ati+" "+
grup[j].fam+" "+IntToStr(grup[j].tugG));
} //ati boinsha syriptay bitti
if (RadioGroup1->ItemIndex==2) //tugG boinsha syriptay bastaldi
{Memo1->Clear();
for(int i=0;i<n;i++)
{ stud max=grup[i]; int maxI=i;
for (int j=i;j<n;j++)
if (grup[j].tugG > max.tugG)
{max=grup[j]; maxI=j;}
Memo1->Lines->Add(max.ati+" "+
max.fam+" "+IntToStr(max.tugG));
grup[maxI]=grup[i];
grup[i]=max;
}
}//tugG boinsha syriptay bitti
}
Ө ұ :
Қң ң ә ү қ, қ .. ңқ құ ә ғ ң min ә ң.
Қң ң ә Ө қ, ө қ ә қ, қ ә қғқ, қғқ ғ қ ң ғ ң.
Қң ң ә A- қ , қ ғ қ қ , қ ө қ қ ғ құң.
Қң ң ә қ үң ә ң қ , қ , қ ң құ, ғғ ә ө ң. ң қ ә ң қ ө .
Қң ң ә ғ , ққ ә ғ ә ү қ ұ ғ ң.
Қң ң ә ғ әң -ө , ғ ә ң ө ұ ғ құң.
ʳғ , , ққ , ғ ә ұ құң.
қ ұ ө ң ә ұ ғ ә ң ң ң ү құң.
ққ ң ә ә ғ , ү ә ұ құң.
қ ң қ ә , ү ә ә ұ ғ құң.
|
|
6 - қ ұ.