O’zbekiston respublikasi axborot texnologiyari va kommunikatsiyalarini rivojlantirish vazirligi muhammad Al-Xorazmiy nomidagi Toshkent Axborot Texnologiyalari Universiteti Dasturlash II mustaqil ish


Download 253.37 Kb.
Sana21.11.2023
Hajmi253.37 Kb.
#1792846
Bog'liq
dasturlash mustaqil ish


O’ZBEKISTON RESPUBLIKASI AXBOROT TEXNOLOGIYARI VA KOMMUNIKATSIYALARINI RIVOJLANTIRISH VAZIRLIGI


Muhammad Al-Xorazmiy nomidagi Toshkent Axborot Texnologiyalari Universiteti

Dasturlash II

Mustaqil ish

Guruh: 028-21


Topshirdi: G’ayratov Husniddin

Toshkent - 2023


Mustaqil ish mavzusi: Visual C++ Forma muxitida ixtiyoriy dastur tuzing. Dasturni word formatga rasmiylashtirib loyiha bilan birga bitta papakaga ziplab yuboring. Eslatma: Mustaqil ish vazifasini Visual C++ dasturlash (muxitida) qilishingiz shart.

#pragma once


#include

float a,b,c,d,x1,x2;


namespace WindowsFormsApplication28 {



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 Form1
///

public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}

protected:


///
/// Clean up any resources being used.
///

~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Label^ label1;
protected:
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::TextBox^ textBox2;
private: System::Windows::Forms::TextBox^ textBox3;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Label^ label5;
private: System::Windows::Forms::Label^ label6;
private: System::Windows::Forms::TextBox^ textBox4;
private: System::Windows::Forms::TextBox^ textBox5;
private: System::Windows::Forms::Label^ label7;
private: System::Windows::Forms::TextBox^ textBox6;
private: System::Windows::Forms::Button^ button2;

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->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->textBox3 = (gcnew System::Windows::Forms::TextBox());
this->label4 = (gcnew System::Windows::Forms::Label());
this->button1 = (gcnew System::Windows::Forms::Button());
this->label5 = (gcnew System::Windows::Forms::Label());
this->label6 = (gcnew System::Windows::Forms::Label());
this->textBox4 = (gcnew System::Windows::Forms::TextBox());
this->textBox5 = (gcnew System::Windows::Forms::TextBox());
this->label7 = (gcnew System::Windows::Forms::Label());
this->textBox6 = (gcnew System::Windows::Forms::TextBox());
this->button2 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->BackColor = System::Drawing::SystemColors::ActiveCaption;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->label1->Location = System::Drawing::Point(92, 85);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(42, 29);
this->label1->TabIndex = 0;
this->label1->Text = L"a=";
//
// label2
//
this->label2->AutoSize = true;
this->label2->BackColor = System::Drawing::SystemColors::ActiveCaption;
this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->label2->Location = System::Drawing::Point(92, 140);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(42, 29);
this->label2->TabIndex = 0;
this->label2->Text = L"b=";
//
// label3
//
this->label3->AutoSize = true;
this->label3->BackColor = System::Drawing::SystemColors::ActiveCaption;
this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->label3->Location = System::Drawing::Point(92, 198);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(41, 29);
this->label3->TabIndex = 0;
this->label3->Text = L"c=";
//
// textBox1
//
this->textBox1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox1->Location = System::Drawing::Point(242, 91);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(148, 36);
this->textBox1->TabIndex = 1;
//
// textBox2
//
this->textBox2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox2->Location = System::Drawing::Point(242, 140);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(148, 36);
this->textBox2->TabIndex = 1;
//
// textBox3
//
this->textBox3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox3->Location = System::Drawing::Point(242, 191);
this->textBox3->Name = L"textBox3";
this->textBox3->Size = System::Drawing::Size(148, 36);
this->textBox3->TabIndex = 1;
//
// label4
//
this->label4->AutoSize = true;
this->label4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 20, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->label4->Location = System::Drawing::Point(242, 13);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(220, 39);
this->label4->TabIndex = 2;
this->label4->Text = L"ax^2+bx+c=0";
//
// button1
//
this->button1->BackColor = System::Drawing::Color::DarkBlue;
this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->button1->Location = System::Drawing::Point(455, 91);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(159, 65);
this->button1->TabIndex = 3;
this->button1->Text = L"Hisobla";
this->button1->UseVisualStyleBackColor = false;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// label5
//
this->label5->AutoSize = true;
this->label5->BackColor = System::Drawing::SystemColors::ActiveCaption;
this->label5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->label5->Location = System::Drawing::Point(12, 253);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(54, 29);
this->label5->TabIndex = 0;
this->label5->Text = L"x1=";
//
// label6
//
this->label6->AutoSize = true;
this->label6->BackColor = System::Drawing::SystemColors::ActiveCaption;
this->label6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->label6->Location = System::Drawing::Point(396, 257);
this->label6->Name = L"label6";
this->label6->Size = System::Drawing::Size(54, 29);
this->label6->TabIndex = 0;
this->label6->Text = L"x2=";
//
// textBox4
//
this->textBox4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox4->Location = System::Drawing::Point(161, 250);
this->textBox4->Name = L"textBox4";
this->textBox4->Size = System::Drawing::Size(148, 36);
this->textBox4->TabIndex = 1;
//
// textBox5
//
this->textBox5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox5->Location = System::Drawing::Point(545, 250);
this->textBox5->Name = L"textBox5";
this->textBox5->Size = System::Drawing::Size(148, 36);
this->textBox5->TabIndex = 1;
//
// label7
//
this->label7->AutoSize = true;
this->label7->BackColor = System::Drawing::SystemColors::ActiveCaption;
this->label7->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->label7->Location = System::Drawing::Point(109, 357);
this->label7->Name = L"label7";
this->label7->Size = System::Drawing::Size(46, 29);
this->label7->TabIndex = 0;
this->label7->Text = L"D=";
//
// textBox6
//
this->textBox6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 15, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->textBox6->Location = System::Drawing::Point(258, 354);
this->textBox6->Name = L"textBox6";
this->textBox6->Size = System::Drawing::Size(148, 36);
this->textBox6->TabIndex = 1;
//
// button2
//
this->button2->BackColor = System::Drawing::Color::Brown;
this->button2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast(204)));
this->button2->Location = System::Drawing::Point(455, 354);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(159, 65);
this->button2->TabIndex = 3;
this->button2->Text = L"chiqish";
this->button2->UseVisualStyleBackColor = false;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// Form1
//
this->AccessibleRole = System::Windows::Forms::AccessibleRole::None;
this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->BackColor = System::Drawing::Color::Chartreuse;
this->ClientSize = System::Drawing::Size(720, 458);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Controls->Add(this->label4);
this->Controls->Add(this->textBox5);
this->Controls->Add(this->textBox6);
this->Controls->Add(this->textBox4);
this->Controls->Add(this->textBox3);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->label7);
this->Controls->Add(this->label6);
this->Controls->Add(this->label5);
this->Controls->Add(this->label3);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Name = L"Form1";
this->Text = L"form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();

}
#pragma endregion


private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
a=Convert::ToInt32(textBox1->Text);
b=Convert::ToInt32(textBox2->Text);
c=Convert::ToInt32(textBox3->Text);
if(a==0){
x1=-c/b;
x2=x1;
}else{
d=b*b-4*a*c;
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/(2*a);
}
textBox4->Text=""+x1;
textBox5->Text=""+x2;
textBox6->Text=""+d;
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
this->Close();
}
};
}



Download 253.37 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling