dastur tuzing. (2 ta Label, 2 ta TextBox, 1 ta Button. Natija Labelda chiqarilsin)
Tomoni B bo’lgan kvadrat berilgan. Uning ichiga joylashtirish mumkin bo’lgan R radiusli doiralar sonini toping. (2 ta Label, 2 ta TextBox, 1 ta Button. Natija Labelda chiqarilsin)
int a, b, S;
a = Convert::ToInt32(textBox1->Text);
b = Convert::ToInt32(textBox2->Text);
S = (a*b / 2)*sin(1);
label6->Text = "Natija : Yuzasi " + Convert::ToString(S) + " ga teng";
6. O’nlik sanoq sistemasidagi A son berilgan. Uning ikkilik sanoq sistemasidagi ko’rinishini Labelda chop eting
7. Uchburchakning uchta tomoni berilgan. Uning tomonlariga ko’ra turini aniqlash dasturing tuzing. (Ko’rsatma: 3 ta Label, 3 ta TextBox, 1 ta Button. Natija Labelda chop etilsin)
8. Doiraning yuzi S berilgan. Uni chegaralab turgan aylana uzunligini toping. (1 ta Label, 1 taTextBox, 1 ta Button. Natija Labelda chop etilsin)
double S, L;
float const P = 3.14;
if (textBox1->Text->Length == 0) {
MessageBox::Show("son kiriting ", "Xatolik yuz berdi", MessageBoxButtons::OK, MessageBoxIcon::Error);
}
else
{
S = Convert::ToDouble(textBox1->Text);
if (S == 0)
{
MessageBox::Show("0 dan katta qiymat bering ", "Noto'g'ri qiymat", MessageBoxButtons::OK, MessageBoxIcon::Error);
}
else
{
L = 2 * P*sqrt(S / P);
label2->Text = "Doirani chegaralab turgan aylana uzunligi= " + L;
}
}
9. Kubning hajmi V berilgan. Kubning yon sirti yuzini aniqlang (1 ta Label, 1 ta TextBox, 1 ta Button. Natija Labelda chop etilsin)
10. Berilgan a,b,c koeffisiyentga asosan ax4+bx2+c=0 bikvadrat tenglama yechish dasturini tuzing. (Ko’rsatma: 3 ta Label, 3 ta TextBox, 1 ta Button. Natija 2 ta Labelda chiqarilsin) double a, b, c, x1, x2, D, X, t1, t2, T;
a = Convert::ToInt16(textBox1->Text);
b = Convert::ToInt16(textBox2->Text);
c = Convert::ToInt16(textBox3->Text);
D = pow(b, 2) - (4 * a*c);
if (D > 0)
{
t1 = (-b + sqrt(D)) / (2 * a);t2 = (-b - sqrt(D)) / (2 * a);
if (t1 > 0 && t2 > 0)
{
x1 = sqrt(t1);
x2 = sqrt(t2);
label6->Text = "Natija : x1 = " + Convert::ToString(x1);
label7->Text = "x3 = -" + Convert::ToString(x1);
label6->Text += " x2 = " + Convert::ToString(x2);
label7->Text += " x4 = -" + Convert::ToString(x2);
}
else
{
if (t1 > 0 && t2 < 0)
{
x1 = sqrt(t1);
label6->Text = "Natija : x1 = " +
Convert::ToString(x1);
}
else
{
MessageBox::Show("x1 yechimga ega emas", "Error",
MessageBoxButtons::OK);
}
if (t1 < 0 && t2 > 0)
{
x2 = sqrt(t2);
label6->Text = "Natija : x2 = " +
Convert::ToString(x2);
}
else {
MessageBox::Show("x2 yechimga ega emas", "Error",
MessageBoxButtons::OK);
}
}
}
else if (D == 0)
{
T = (-b + sqrt(D)) / (2 * a);
X = sqrt(T);
if (T > 0) {
label6->Text = "Natija : x2 = " + Convert::ToString(X);
}
else
{
MessageBox::Show("X yechimga ega emas", "Error",
MessageBoxButtons::OK);
}
}
else if (D < 0) {
MessageBox::Show("Yechimga ega emas", "Error",
MessageBoxButtons::OK);
}
Do'stlaringiz bilan baham: |