O’ZBEKISTON RESPUBLIKASI RAQAMLI TEXNOLOGIYALARNI RIVOJLANTIRISH VAZIRLIGI
MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALAR UNIVERSITETI
Kamolov Bekmirzoning
Dasturlash-2 fanidan
2-Amaliy ishi
Guruhi: 007-3
Bajardi : Kamolov Bekmirzo
Tekshirdi : Olimova Muxlisa
1-misol
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
double a, b, c, d;
if (Double::TryParse(textBox1->Text, a) && Double::TryParse(textBox2->Text, b) &&
Double::TryParse(textBox3->Text, c) && Double::TryParse(textBox4->Text, d)) {
double result = a / 3 * Math::Pow(d, 3) + b / 2 * Math::Pow(c, 2);
textBox5->Text = result.ToString();
}
else {
MessageBox::Show("Faqat sonlarni kiriting!", "Xato", MessageBoxButtons::OK, MessageBoxIcon::Error);
}
}
};
}
2-misol
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
String^ xStr = this->textBox1->Text;
String^ yStr = this->textBox2->Text;
String^ zStr = this->textBox3->Text;
double x = Double::Parse(xStr);
double y = Double::Parse(yStr);
double z = Double::Parse(zStr);
if (x == -y || y == -25) {
this->textBox4->Text = "Error: maxraj nolga teng bo`lishi mumkin emas";
return; // Agar shart qanoatlantirilsa, dasturni to'xtatamiz
}
double result = (Math::Pow(y, x + 1) / (Math::Pow((y - 2),3) + 3)) + ((x + (y / 2)) / (2 * Math::Abs(x + y))) * Math::Pow(x + 1, -1 /Math::Sin(z));
this->textBox4->Text = result.ToString();
}
};
}
|