• InsertionSort(Davlatlar.begin(), Davlatlar.end()); for (auto t : Davlatlar) t->print(); }
  • iter Begin = begin, End = --end




    Download 0.82 Mb.
    bet2/2
    Sana27.07.2023
    Hajmi0.82 Mb.
    #77426
    1   2
    Bog'liq
    7,8 dasturlash(ferangiz)
    Tovar-pul munosabatining shakllanishi, innovatsion jarayonlar majmua , Kreativ fikrlashni rivojlantirishda samarali usullardan foydalanish, jadval, СЕРДЕЧНЫЕ ГЛИКОЗИДЫ, Mavzu Loyiha t-WPS Office, Anemiya, 155 Miqdoriy taxlil, arshi mu andislik-i tisodiyot instituti “Axborot texnologiyalar
    iter Begin = begin, End = --end;
    for (; begin != End; ) {
    iter prev = ++begin;
    begin--;
    if ((*begin)->aholi > (*prev)->aholi) {
    swap(*begin, *prev);
    for (; begin != Begin; begin--) {
    iter leftpos = --begin;
    begin++;
    if ((*leftpos)->aholi > (*begin)->aholi) swap(*leftpos, *begin);
    else break;
    }
    }
    if (prev == End) break;
    begin = prev;
    }
    }
    int main() {
    list Davlatlar = { new Shahar("Germany", 3000000, "deustch", "Munich", 2000),
    new Shahar("Italy", 2100000, "italian", "Rome", 2500),
    new Shahar("England", 4500000, "english", "Liverpool", 2600),
    new Shahar("Uzbekistan", 1500000, "uzbek", "Tashkent", 2700),
    new Shahar("Qazakstan", 3570000, "qazaks", "Astana", 3200)
    };
    InsertionSort(Davlatlar.begin(), Davlatlar.end());
    for (auto t : Davlatlar) t->print();
    }

    2.Formada 1-formada a[N][M] massiv elementlarini [-100; 200] oraliqdagi tasodifiy sonlar bilan to’ldiring. N va M ni yordamida kiriting. Massivni TextBox komponetalari dataGridWiew komponentasiga joylashtiring.Elementining qiymatini bir vaqtda 5 ga va 3 ga qoldiqsiz bo’linadiganlarining soni label komponentasida chiqaring.

    #pragma once


    #include
    #include
    #include
    namespace CppCLRWinformsProjekt {

    using namespace System;


    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;

    ///


    /// Zusammenfassung fьr Form1
    ///

    public ref class Form1 : public System::Windows::Forms::Form
    {
    public:
    Form1(void)
    {
    InitializeComponent();
    //
    //TODO: Konstruktorcode hier hinzufьgen.
    //
    }

    protected:


    ///
    /// Verwendete Ressourcen bereinigen.
    ///

    ~Form1()
    {
    if (components)
    {
    delete components;
    }
    }
    private: System::Windows::Forms::Label^ label1;
    protected:
    private: System::Windows::Forms::TextBox^ textBox1;
    private: System::Windows::Forms::Label^ label2;
    private: System::Windows::Forms::TextBox^ textBox2;
    private: System::Windows::Forms::DataGridView^ dataGridView1;
    private: System::Windows::Forms::Button^ button1;
    private: System::Windows::Forms::Label^ label3;
    private: System::Windows::Forms::Label^ label4;
    private: System::Windows::Forms::Label^ label5;
    private: System::Windows::Forms::Label^ label6;

    private:
    ///


    /// Erforderliche Designervariable.
    ///

    System::ComponentModel::Container ^components;

    #pragma region Windows Form Designer generated code


    ///
    /// Erforderliche Methode fьr die Designerunterstьtzung.
    /// Der Inhalt der Methode darf nicht mit dem Code-Editor geдndert werden.
    ///

    void InitializeComponent(void)
    {
    this->label1 = (gcnew System::Windows::Forms::Label());
    this->textBox1 = (gcnew System::Windows::Forms::TextBox());
    this->label2 = (gcnew System::Windows::Forms::Label());
    this->textBox2 = (gcnew System::Windows::Forms::TextBox());
    this->dataGridView1 = (gcnew System::Windows::Forms::DataGridView());
    this->button1 = (gcnew System::Windows::Forms::Button());
    this->label3 = (gcnew System::Windows::Forms::Label());
    this->label4 = (gcnew System::Windows::Forms::Label());
    this->label5 = (gcnew System::Windows::Forms::Label());
    this->label6 = (gcnew System::Windows::Forms::Label());
    (cli::safe_cast(this->dataGridView1))->BeginInit();
    this->SuspendLayout();
    //
    // label1
    //
    this->label1->AutoSize = true;
    this->label1->Font = (gcnew System::Drawing::Font(L"Segoe Print", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
    static_cast(0)));
    this->label1->Location = System::Drawing::Point(24, 80);
    this->label1->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
    this->label1->Name = L"label1";
    this->label1->Size = System::Drawing::Size(54, 51);
    this->label1->TabIndex = 8;
    this->label1->Text = L"N:";
    //
    // textBox1
    //
    this->textBox1->BackColor = System::Drawing::SystemColors::Info;
    this->textBox1->Font = (gcnew System::Drawing::Font(L"Times New Roman", 11.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
    static_cast(204)));
    this->textBox1->Location = System::Drawing::Point(82, 94);
    this->textBox1->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
    this->textBox1->Name = L"textBox1";
    this->textBox1->Size = System::Drawing::Size(157, 33);
    this->textBox1->TabIndex = 7;
    this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);
    //
    // label2
    //this->label2->AutoSize = true;
    this->label2->Font = (gcnew System::Drawing::Font(L"Segoe Print", 14.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
    static_cast(0)));
    this->label2->Location = System::Drawing::Point(24, 151);

    this->label2->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);


    this->label2->Name = L"label2";
    this->label2->Size = System::Drawing::Size(58, 51);
    this->label2->TabIndex = 10;
    this->label2->Text = L"M:";
    //
    // textBox2
    //
    this->textBox2->BackColor = System::Drawing::SystemColors::Info;
    this->textBox2->Font = (gcnew System::Drawing::Font(L"Times New Roman", 11.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
    static_cast(204)));
    this->textBox2->Location = System::Drawing::Point(82, 169);
    this->textBox2->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
    this->textBox2->Name = L"textBox2";
    this->textBox2->Size = System::Drawing::Size(157, 33);
    this->textBox2->TabIndex = 9;
    //
    // dataGridView1
    //
    this->dataGridView1->AllowUserToOrderColumns = true;
    this->dataGridView1->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::DisableResizing;
    this->dataGridView1->Location = System::Drawing::Point(247, 80);
    this->dataGridView1->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
    this->dataGridView1->Name = L"dataGridView1";
    this->dataGridView1->RowHeadersWidth = 10;
    this->dataGridView1->Size = System::Drawing::Size(1047, 490);
    this->dataGridView1->TabIndex = 11;
    //
    // button1
    //
    this->button1->BackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(128)), static_cast(static_cast(255)),
    static_cast(static_cast(128)));
    this->button1->Font = (gcnew System::Drawing::Font(L"Algerian", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
    static_cast(0)));
    this->button1->Location = System::Drawing::Point(37, 246);
    this->button1->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
    this->button1->Name = L"button1";
    this->button1->Size = System::Drawing::Size(142, 77);
    this->button1->TabIndex = 12;
    this->button1->Text = L"QIDIR:";
    this->button1->UseVisualStyleBackColor = false;
    this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
    //
    // label3
    //
    this->label3->AutoSize = true;
    this->label3->Font = (gcnew System::Drawing::Font(L"Segoe Script", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
    static_cast(0)));
    this->label3->Location = System::Drawing::Point(30, 532);
    this->label3->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
    this->label3->Name = L"label3";
    this->label3->Size = System::Drawing::Size(0, 38);
    this->label3->TabIndex = 13;
    //
    // label4
    //
    this->label4->AutoSize = true;
    this->label4->Font = (gcnew System::Drawing::Font(L"Segoe Script", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
    static_cast(0)));
    this->label4->Location = System::Drawing::Point(654, 532);
    this->label4->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
    this->label4->Name = L"label4";
    this->label4->Size = System::Drawing::Size(0, 38);
    this->label4->TabIndex = 14;
    //
    // label5
    //
    this->label5->AutoSize = true; this->label5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 10, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
    static_cast(204)));
    this->label5->Location = System::Drawing::Point(0, 0);
    this->label5->Name = L"label5";
    this->label5->Size = System::Drawing::Size(1254, 25);
    this->label5->TabIndex = 15;
    this->label5->Text = L"Formada a[N][M] massiv elementlarini [100; 200] oraliqdagi tasodifiy sonlar bil"

    L"an to’ldiring. N va M ni TextBox komponetalari yordamida kiriting.\r\n";


    this->label5->Click += gcnew System::EventHandler(this, &Form1::label5_Click);
    //
    // label6
    //
    this->label6->AutoSize = true;
    this->label6->Font = (gcnew System::Drawing::Font(L"Consolas", 10, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point,
    static_cast(204)));
    this->label6->Location = System::Drawing::Point(1, 25);
    this->label6->Name = L"label6";
    this->label6->Size = System::Drawing::Size(1308, 23);
    this->label6->TabIndex = 16;
    this->label6->Text = L" Massivni dataGridWiew komponentasiga joylashtiring. Massiv elementlari tublari s"
    L"onini label komponentasida chiqaring.";
    this->label6->Click += gcnew System::EventHandler(this, &Form1::label6_Click);
    //
    // Form1
    //
    this->AutoScaleDimensions = System::Drawing::SizeF(9, 20);
    this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    this->BackColor = System::Drawing::Color::FromArgb(static_cast(static_cast(255)), static_cast(static_cast(255)),
    static_cast(static_cast(192)));
    this->ClientSize = System::Drawing::Size(1307, 598);
    this->Controls->Add(this->label6);
    this->Controls->Add(this->label5);
    this->Controls->Add(this->label4);
    this->Controls->Add(this->label3);
    this->Controls->Add(this->button1);
    this->Controls->Add(this->dataGridView1);
    this->Controls->Add(this->label2);
    this->Controls->Add(this->textBox2);
    this->Controls->Add(this->label1);
    this->Controls->Add(this->textBox1);
    this->Margin = System::Windows::Forms::Padding(4, 5, 4, 5);
    this->Name = L"Form1";
    this->Text = L"7,8-laboratoriya ishi.";
    (cli::safe_cast(this->dataGridView1))->EndInit();
    this->ResumeLayout(false);
    this->PerformLayout();

    }
    #pragma endregion


    bool tub(int son) {
    int key = 0;
    for (int c = 1; c < son; c++) if (son % c == 0) key++;
    if (key < 3) return true;
    return false;
    }
    private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
    srand(time(0));
    int a = Convert::ToInt32(textBox1->Text), b = Convert::ToInt32(textBox2->Text);
    std::valarray sonlar(a * b);
    for (int c = 0; c < a * b; c++) sonlar[c] = rand() % 901 + 100;
    DataTable^ Table = gcnew DataTable();
    for (int c = 0; c < b; c++)Table->Columns->Add(Convert::ToString(c));
    for (int c = 0; c < a; c++) {
    int ptr = 0;
    array^ values = gcnew array(b);
    for (auto t : std::valarray(sonlar[std::slice(c * b, b, 1)])) values[ptr++] = t;
    Table->Rows->Add(values);
    }
    dataGridView1->DataSource = Table;
    int count = 0;
    for (auto t : sonlar) if (tub(t)) count++;
    label3->Text = Convert::ToString("Tub elementlar soni = " + count);
    }
    private: System::Void label5_Click(System::Object^ sender, System::EventArgs^ e)
    private: System::Void label6_Click(System::Object^ sender, System::EventArgs^ e) {
    }
    private: System::Void label6_Click(System::Object^ sender, System::EventArgs^ e) {
    }
    private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
    }
    }
    };
    }



    3. Foydalanuvchilarning login va parollarini tekshiruvchi FORMA yaratish va Formaga nom berish
    #pragma once

    namespace MCWinApp9 {


    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::Button^ button1;
    private: System::Windows::Forms::CheckBox^ checkBox1;

    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->button1 = (gcnew System::Windows::Forms::Button());
    this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
    this->SuspendLayout();
    //
    // label1
    //
    this->label1->AutoSize = true;
    this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 13.8F, static_cast((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)),
    System::Drawing::GraphicsUnit::Point, static_cast(204)));
    this->label1->Location = System::Drawing::Point(105, 51);
    this->label1->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
    this->label1->Name = L"label1";
    this->label1->Size = System::Drawing::Size(78, 29);
    this->label1->TabIndex = 0;
    this->label1->Text = L"Login";
    this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click);
    //
    // label2
    //
    this->label2->AutoSize = true;
    this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 13.8F, static_cast((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)),
    System::Drawing::GraphicsUnit::Point, static_cast(204)));
    this->label2->Location = System::Drawing::Point(105, 121);
    this->label2->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
    this->label2->Name = L"label2";
    this->label2->Size = System::Drawing::Size(75, 29);
    this->label2->TabIndex = 1;
    this->label2->Text = L"Parol";
    this->label2->Click += gcnew System::EventHandler(this, &Form1::label2_Click);
    //
    // label3
    //
    this->label3->AutoSize = true;
    this->label3->Font = (gcnew System::Drawing::Font(L"Modern No. 20", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
    static_cast(0)));
    this->label3->Location = System::Drawing::Point(106, 324);
    this->label3->Margin = System::Windows::Forms::Padding(4, 0, 4, 0);
    this->label3->Name = L"label3";
    this->label3->Size = System::Drawing::Size(0, 22);
    this->label3->TabIndex = 2;
    this->label3->Click += gcnew System::EventHandler(this, &Form1::label3_Click);
    //
    // textBox1
    //
    this->textBox1->Cursor = System::Windows::Forms::Cursors::IBeam;
    this->textBox1->ForeColor = System::Drawing::Color::FromArgb(static_cast(static_cast(0)), static_cast(static_cast(0)),
    static_cast(static_cast(64)));
    this->textBox1->Location = System::Drawing::Point(106, 84);
    this->textBox1->Margin = System::Windows::Forms::Padding(4);
    this->textBox1->Multiline = true;
    this->textBox1->Name = L"textBox1";
    this->textBox1->Size = System::Drawing::Size(250, 22);
    this->textBox1->TabIndex = 3;
    this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);
    //
    // textBox2
    //
    this->textBox2->Location = System::Drawing::Point(106, 154);
    this->textBox2->Margin = System::Windows::Forms::Padding(4);
    this->textBox2->Multiline = true;
    this->textBox2->Name = L"textBox2";
    this->textBox2->Size = System::Drawing::Size(250, 22);
    this->textBox2->TabIndex = 4;
    this->textBox2->TextChanged += gcnew System::EventHandler(this, &Form1::textBox2_TextChanged);
    //
    // button1
    //
    this->button1->BackColor = System::Drawing::Color::Lime;
    this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 13.8F, static_cast((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)),
    System::Drawing::GraphicsUnit::Point, static_cast(204)));
    this->button1->ForeColor = System::Drawing::SystemColors::Highlight;
    this->button1->Location = System::Drawing::Point(444, 462);
    this->button1->Margin = System::Windows::Forms::Padding(4);
    this->button1->Name = L"button1";
    this->button1->Size = System::Drawing::Size(165, 79);
    this->button1->TabIndex = 5;
    this->button1->Text = L"Kirish";
    this->button1->UseVisualStyleBackColor = false;
    this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
    //
    // checkBox1
    //
    this->checkBox1->AutoSize = true;
    this->checkBox1->Font = (gcnew System::Drawing::Font(L"Segoe UI", 12, static_cast((System::Drawing::FontStyle::Bold | System::Drawing::FontStyle::Italic)),
    System::Drawing::GraphicsUnit::Point, static_cast(204)));
    this->checkBox1->ForeColor = System::Drawing::Color::Black;
    this->checkBox1->Location = System::Drawing::Point(106, 275);
    this->checkBox1->Margin = System::Windows::Forms::Padding(6);
    this->checkBox1->Name = L"checkBox1";
    this->checkBox1->Size = System::Drawing::Size(312, 32);
    this->checkBox1->TabIndex = 6;
    this->checkBox1->Text = L"Malumotni ekranda chiqarish";
    this->checkBox1->UseVisualStyleBackColor = true;
    this->checkBox1->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox1_CheckedChanged);
    //
    // Form1
    //
    this->AutoScaleDimensions = System::Drawing::SizeF(11, 20);
    this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    this->BackColor = System::Drawing::Color::PaleTurquoise;
    this->ClientSize = System::Drawing::Size(622, 554);
    this->Controls->Add(this->checkBox1);
    this->Controls->Add(this->button1);
    this->Controls->Add(this->textBox2);
    this->Controls->Add(this->textBox1);
    this->Controls->Add(this->label3);
    this->Controls->Add(this->label2);
    this->Controls->Add(this->label1);
    this->Font = (gcnew System::Drawing::Font(L"Modern No. 20", 10.2F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,
    static_cast(0)));
    this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::Fixed3D;
    this->Margin = System::Windows::Forms::Padding(4);
    this->Name = L"Form1";
    this->Text = L"Enter page";
    this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
    this->ResumeLayout(false);
    this->PerformLayout();

    }
    #pragma endregion


    private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) {
    }
    private: System::Void label2_Click(System::Object^ sender, System::EventArgs^ e) {
    }
    private: System::Void label3_Click(System::Object^ sender, System::EventArgs^ e) {
    }
    private: System::Void textBox1_TextChanged(System::Object^ sender, System::EventArgs^ e) {
    }
    private: System::Void textBox2_TextChanged(System::Object^ sender, System::EventArgs^ e) {
    }
    private: System::Void checkBox1_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
    }
    private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {

    if(textBox1->Text=="Ferangiz" && textBox2->Text=="Nasulloyeva")


    {
    if(checkBox1->Checked==true)
    label3->Text="Ferangiz SWD007";
    else
    MessageBox::Show("Ferangiz SWD007");
    }
    else
    {

    if(checkBox1->Checked==true)
    label3->Text="Bunday login yoki parol mavjud emas";
    else
    MessageBox::Show("Bunday login yoki parol mavjud emas");
    }
    }
    private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
    }
    };
    }

    Download 0.82 Mb.
    1   2




    Download 0.82 Mb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    iter Begin = begin, End = --end

    Download 0.82 Mb.