Sharof rashidov nomidagi samarqand davlat universiteti intelektual tizimlar va innvation tizimlar fakulteti dasturiy injinirngi yo
Download 80.4 Kb.
|
Javohir Achilov Labaratoriya
- Bu sahifa navigatsiya:
- DASTURLASH ASOSLARI FANIDAN TAYYORLAGAN
- Dasturning visual ko’rinishi. Dastur kodi
O‘ZBEKISTON RESPUBLIKASI OLIY VA O‘RTA-MAXSUS TA’LIM VAZIRLIGI SHAROF RASHIDOV NOMIDAGI SAMARQAND DAVLAT UNIVERSITETI INTELEKTUAL TIZIMLAR VA INNVATION TIZIMLAR FAKULTETI DASTURIY INJINIRNGI YO‘NALISHI 306 – GURUH TALABASI Achilov JavohirNING DASTURLASH ASOSLARI FANIDAN TAYYORLAGAN LABARATORYA ISHI Tekshirdi: E.Eshonqulov. SAMARQAND – 2022 1-Topshiriq. Masala sharti: (3) Teng tomonli uchburchakning tomonlari a berilgan. Ushbu uchburchakning yuzini, balandligini, unga tashqi chizilgan aylananing radiusini topish dasturini tuzing. (Ko’rsatma: 1 ta Label, 1 ta TextBox, 1 ta Button. Natijalar Labelda chiqarilsin). Dasturning visual ko’rinishi. Dastur kodi: #pragma once #include "math.h" namespace Teng_yonli_uchburchak { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; /// /// Summary for MyForm /// public ref class MyForm : public System::Windows::Forms::Form { public: MyForm(void) { InitializeComponent(); // //TODO: Add the constructor code here // } protected: /// /// Clean up any resources being used. /// ~MyForm() { if (components) { delete components; } } private: System::Windows::Forms::Button^ button1; private: System::Windows::Forms::TextBox^ textBox1; private: System::Windows::Forms::Label^ S; private: System::Windows::Forms::Label^ H; private: System::Windows::Forms::Label^ R; protected: private: /// /// Required designer variable. /// System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// void InitializeComponent(void) { this->button1 = (gcnew System::Windows::Forms::Button()); this->textBox1 = (gcnew System::Windows::Forms::TextBox()); this->S = (gcnew System::Windows::Forms::Label()); this->H = (gcnew System::Windows::Forms::Label()); this->R = (gcnew System::Windows::Forms::Label()); this->SuspendLayout(); // // button1 // this->button1->BackColor = System::Drawing::Color::Cyan; this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, static_cast this->button1->Location = System::Drawing::Point(82, 72); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(114, 35); this->button1->TabIndex = 0; this->button1->Text = L"Hisoblash"; this->button1->UseVisualStyleBackColor = false; this->button1->Click += gcnew System::EventHandler(this, &MyForm::button1_Click); // // textBox1 // this->textBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15.75F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast this->textBox1->Location = System::Drawing::Point(68, 12); this->textBox1->Name = L"textBox1"; this->textBox1->Size = System::Drawing::Size(148, 31); this->textBox1->TabIndex = 2; this->textBox1->TextAlign = System::Windows::Forms::HorizontalAlignment::Center; this->textBox1->TextChanged += gcnew System::EventHandler(this, &MyForm::textBox1_TextChanged); // // S // this->S->AutoSize = true; this->S->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast this->S->Location = System::Drawing::Point(38, 128); this->S->Name = L"S"; this->S->Size = System::Drawing::Size(30, 24); this->S->TabIndex = 3; this->S->Text = L"s="; this->S->Click += gcnew System::EventHandler(this, &MyForm::label2_Click); // // H // this->H->AutoSize = true; this->H->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast this->H->Location = System::Drawing::Point(38, 152); this->H->Name = L"H"; this->H->Size = System::Drawing::Size(32, 24); this->H->TabIndex = 5; this->H->Text = L"h="; // // R // this->R->AutoSize = true; this->R->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, static_cast this->R->Location = System::Drawing::Point(38, 176); this->R->Name = L"R"; this->R->Size = System::Drawing::Size(27, 24); this->R->TabIndex = 6; this->R->Text = L"r="; // // MyForm // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->BackColor = System::Drawing::SystemColors::Control; this->ClientSize = System::Drawing::Size(281, 210); this->Controls->Add(this->R); this->Controls->Add(this->H); this->Controls->Add(this->S); this->Controls->Add(this->textBox1); this->Controls->Add(this->button1); this->Name = L"MyForm"; this->Text = L"Uchburchak"; this->ResumeLayout(false); this->PerformLayout(); }
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { int a; double s,r,h; a = Convert::ToInt16(textBox1->Text); if (a>0) { s = sqrt(3)*a*a / 4; r = a / sqrt(3); h = a*sqrt(3) / 2; S->Text += s; R->Text += r; H->Text += h; } else MessageBox::Show("Qiymat noto'g'ri kiritildi!", "Xatolik", MessageBoxButtons::OK, MessageBoxIcon::Error); }
private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) { } private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) { } private: System::Void label2_Click(System::Object^ sender, System::EventArgs^ e) { } }; } Download 80.4 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling