Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <iostream>
- #include <string>
- using namespace std;
- long double fact(int N)
- {
- if (N < 0)
- return 0;
- if (N == 0)
- return 1;
- else
- return N * fact(N - 1);
- }
- namespace Project1 {
- 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>
- /// Сводка для MainForm
- /// </summary>
- public ref class MainForm : public System::Windows::Forms::Form
- {
- public:
- MainForm(void)
- {
- InitializeComponent();
- //
- //TODO: добавьте код конструктора
- //
- }
- protected:
- /// <summary>
- /// Освободить все используемые ресурсы.
- /// </summary>
- ~MainForm()
- {
- if (components)
- {
- delete components;
- }
- }
- private: System::ComponentModel::BackgroundWorker^ backgroundWorker1;
- protected:
- private: System::Windows::Forms::Label^ label1;
- private: System::Windows::Forms::TextBox^ text1;
- private: System::Windows::Forms::Label^ label2;
- private: System::Windows::Forms::TableLayoutPanel^ tableLayoutPanel1;
- private: System::Windows::Forms::Button^ button1;
- private: System::Windows::Forms::Label^ label3;
- private: System::Windows::Forms::TextBox^ text2;
- private: System::Windows::Forms::Button^ button3;
- private: System::Windows::Forms::Button^ button2;
- private: System::Windows::Forms::TableLayoutPanel^ tableLayoutPanel2;
- private: System::Windows::Forms::Button^ button4;
- private: System::Windows::Forms::Button^ button5;
- private:
- /// <summary>
- /// Обязательная переменная конструктора.
- /// </summary>
- System::ComponentModel::Container ^components;
- #pragma region Windows Form Designer generated code
- /// <summary>
- /// Требуемый метод для поддержки конструктора — не изменяйте
- /// содержимое этого метода с помощью редактора кода.
- /// </summary>
- void InitializeComponent(void)
- {
- this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
- this->label1 = (gcnew System::Windows::Forms::Label());
- this->text1 = (gcnew System::Windows::Forms::TextBox());
- this->label2 = (gcnew System::Windows::Forms::Label());
- this->tableLayoutPanel1 = (gcnew System::Windows::Forms::TableLayoutPanel());
- this->button3 = (gcnew System::Windows::Forms::Button());
- this->button1 = (gcnew System::Windows::Forms::Button());
- this->button2 = (gcnew System::Windows::Forms::Button());
- this->label3 = (gcnew System::Windows::Forms::Label());
- this->text2 = (gcnew System::Windows::Forms::TextBox());
- this->tableLayoutPanel2 = (gcnew System::Windows::Forms::TableLayoutPanel());
- this->button4 = (gcnew System::Windows::Forms::Button());
- this->button5 = (gcnew System::Windows::Forms::Button());
- this->tableLayoutPanel1->SuspendLayout();
- this->tableLayoutPanel2->SuspendLayout();
- this->SuspendLayout();
- //
- // label1
- //
- this->label1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
- | System::Windows::Forms::AnchorStyles::Right));
- this->label1->AutoSize = true;
- this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 16.2F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(204)));
- this->label1->Location = System::Drawing::Point(12, 9);
- this->label1->Name = L"label1";
- this->label1->Size = System::Drawing::Size(191, 32);
- this->label1->TabIndex = 0;
- this->label1->Text = L"Your numbers";
- //
- // text1
- //
- this->text1->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
- | System::Windows::Forms::AnchorStyles::Right));
- this->text1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(204)));
- this->text1->Location = System::Drawing::Point(18, 75);
- this->text1->Name = L"text1";
- this->text1->Size = System::Drawing::Size(552, 30);
- this->text1->TabIndex = 1;
- //
- // label2
- //
- this->label2->AutoSize = true;
- this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 16.2F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(204)));
- this->label2->ForeColor = System::Drawing::Color::Black;
- this->label2->Location = System::Drawing::Point(15, 446);
- this->label2->Name = L"label2";
- this->label2->Size = System::Drawing::Size(152, 32);
- this->label2->TabIndex = 2;
- this->label2->Text = L"Answer =";
- //
- // tableLayoutPanel1
- //
- this->tableLayoutPanel1->ColumnCount = 3;
- this->tableLayoutPanel1->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle(System::Windows::Forms::SizeType::Percent,
- 50)));
- this->tableLayoutPanel1->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle(System::Windows::Forms::SizeType::Absolute,
- 194)));
- this->tableLayoutPanel1->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle(System::Windows::Forms::SizeType::Absolute,
- 182)));
- this->tableLayoutPanel1->Controls->Add(this->button3, 2, 0);
- this->tableLayoutPanel1->Controls->Add(this->button1, 0, 0);
- this->tableLayoutPanel1->Controls->Add(this->button2, 1, 0);
- this->tableLayoutPanel1->Location = System::Drawing::Point(18, 159);
- this->tableLayoutPanel1->Name = L"tableLayoutPanel1";
- this->tableLayoutPanel1->RowCount = 1;
- this->tableLayoutPanel1->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Percent, 50)));
- this->tableLayoutPanel1->Size = System::Drawing::Size(552, 73);
- this->tableLayoutPanel1->TabIndex = 4;
- //
- // button3
- //
- this->button3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 13.8F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(204)));
- this->button3->Location = System::Drawing::Point(373, 3);
- this->button3->Name = L"button3";
- this->button3->Size = System::Drawing::Size(176, 67);
- this->button3->TabIndex = 7;
- this->button3->Text = L"Subtract";
- this->button3->UseVisualStyleBackColor = true;
- this->button3->Click += gcnew System::EventHandler(this, &MainForm::button3_Click);
- //
- // button1
- //
- this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 13.8F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(204)));
- this->button1->Location = System::Drawing::Point(3, 3);
- this->button1->Name = L"button1";
- this->button1->Size = System::Drawing::Size(165, 67);
- this->button1->TabIndex = 0;
- this->button1->Text = L"Summing";
- this->button1->UseVisualStyleBackColor = true;
- this->button1->Click += gcnew System::EventHandler(this, &MainForm::button1_Click);
- //
- // button2
- //
- this->button2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 13.8F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(204)));
- this->button2->Location = System::Drawing::Point(179, 3);
- this->button2->Name = L"button2";
- this->button2->Size = System::Drawing::Size(188, 67);
- this->button2->TabIndex = 7;
- this->button2->Text = L"Multiplicate";
- this->button2->UseVisualStyleBackColor = true;
- this->button2->Click += gcnew System::EventHandler(this, &MainForm::button2_Click);
- //
- // label3
- //
- this->label3->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
- | System::Windows::Forms::AnchorStyles::Right));
- this->label3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 16.2F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(204)));
- this->label3->Location = System::Drawing::Point(191, 446);
- this->label3->Name = L"label3";
- this->label3->Size = System::Drawing::Size(241, 220);
- this->label3->TabIndex = 5;
- this->label3->Text = L"label3";
- //
- // text2
- //
- this->text2->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
- | System::Windows::Forms::AnchorStyles::Right));
- this->text2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(204)));
- this->text2->Location = System::Drawing::Point(18, 111);
- this->text2->Name = L"text2";
- this->text2->Size = System::Drawing::Size(552, 30);
- this->text2->TabIndex = 6;
- //
- // tableLayoutPanel2
- //
- this->tableLayoutPanel2->ColumnCount = 1;
- this->tableLayoutPanel2->ColumnStyles->Add((gcnew System::Windows::Forms::ColumnStyle(System::Windows::Forms::SizeType::Percent,
- 50)));
- this->tableLayoutPanel2->Controls->Add(this->button4, 0, 0);
- this->tableLayoutPanel2->Location = System::Drawing::Point(18, 238);
- this->tableLayoutPanel2->Name = L"tableLayoutPanel2";
- this->tableLayoutPanel2->RowCount = 1;
- this->tableLayoutPanel2->RowStyles->Add((gcnew System::Windows::Forms::RowStyle(System::Windows::Forms::SizeType::Percent, 50)));
- this->tableLayoutPanel2->Size = System::Drawing::Size(549, 100);
- this->tableLayoutPanel2->TabIndex = 7;
- //
- // button4
- //
- this->button4->Font = (gcnew System::Drawing::Font(L"Segoe Script", 24, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(204)));
- this->button4->Location = System::Drawing::Point(3, 3);
- this->button4->Name = L"button4";
- this->button4->Size = System::Drawing::Size(543, 94);
- this->button4->TabIndex = 0;
- this->button4->Text = L"Factorial";
- this->button4->UseVisualStyleBackColor = true;
- this->button4->Click += gcnew System::EventHandler(this, &MainForm::button4_Click);
- //
- // button5
- //
- this->button5->Font = (gcnew System::Drawing::Font(L"Segoe Script", 24, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
- static_cast<System::Byte>(204)));
- this->button5->Location = System::Drawing::Point(21, 341);
- this->button5->Name = L"button5";
- this->button5->Size = System::Drawing::Size(543, 94);
- this->button5->TabIndex = 8;
- this->button5->Text = L"Double ";
- this->button5->UseVisualStyleBackColor = true;
- this->button5->Click += gcnew System::EventHandler(this, &MainForm::button5_Click);
- //
- // MainForm
- //
- this->AutoScaleDimensions = System::Drawing::SizeF(8, 16);
- this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
- this->BackColor = System::Drawing::SystemColors::ActiveCaption;
- this->ClientSize = System::Drawing::Size(582, 553);
- this->Controls->Add(this->button5);
- this->Controls->Add(this->tableLayoutPanel2);
- this->Controls->Add(this->text2);
- this->Controls->Add(this->label3);
- this->Controls->Add(this->tableLayoutPanel1);
- this->Controls->Add(this->label2);
- this->Controls->Add(this->text1);
- this->Controls->Add(this->label1);
- this->MaximumSize = System::Drawing::Size(600, 600);
- this->MinimumSize = System::Drawing::Size(600, 600);
- this->Name = L"MainForm";
- this->Text = L"MainForm";
- this->Load += gcnew System::EventHandler(this, &MainForm::MainForm_Load);
- this->tableLayoutPanel1->ResumeLayout(false);
- this->tableLayoutPanel2->ResumeLayout(false);
- this->ResumeLayout(false);
- this->PerformLayout();
- }
- #pragma endregion
- private: System::Void MainForm_Load(System::Object^ sender, System::EventArgs^ e) {
- this->label3->Text = "";
- }
- private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
- int i = System::Convert::ToDouble(text1->Text);
- int u = System::Convert::ToDouble(text2->Text);
- int y = i + u;
- label3->Text = System::Convert::ToString(y);
- }
- private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
- int i = System::Convert::ToDouble(text1->Text);
- int u = System::Convert::ToDouble(text2->Text);
- int y = i * u;
- label3->Text = System::Convert::ToString(y);
- }
- private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
- int i = System::Convert::ToDouble(text1->Text);
- int u = System::Convert::ToDouble(text2->Text);
- int y = i - u;
- label3->Text = System::Convert::ToString(y);
- }
- private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
- int number = System::Convert::ToDouble(text1->Text);
- int number2 = System::Convert::ToDouble(text2->Text);
- double factor = fact(number);
- double factor2 = fact(number2);
- label3->Text = System::Convert::ToString(factor) + " , " + System::Convert::ToString(factor2);
- }
- private: System::Void button5_Click(System::Object^ sender, System::EventArgs^ e) {
- int i = System::Convert::ToDouble(text1->Text);
- int u = System::Convert::ToDouble(text2->Text);
- int y = 2*i;
- int p = 2 * u;
- label3->Text = System::Convert::ToString(y) + " , " + System::Convert::ToString(p);
- }
- };
- }
Add Comment
Please, Sign In to add comment