close

Вход

Забыли?

вход по аккаунту

?

Вычислительная практика 2

код для вставкиСкачать
Государственное образовательное учреждение
Высшего профессионального образования
"Челябинский государственный университет"
Математический факультет
Отчет по вычислительной практике
Тема: "Решение систем линейных уравнений методом Гаусса с выбором главного элемента"
Выполнил: Юровский И.А.Группа: МПз-301Руководитель: Рудаков Сергей Аркадьевич
Челябинск 2013
I. Решение систем линейных уравнений методом Гаусса с выбором главного элемента.
II. Соглашение о требованиях:
* Программа предназначена для нахождения корней систем линейных уравнений с вещественными коэффициентами.
* Ввод данных осуществляется при помощи заполнения соответствующих полей на форме.
III. Описание программы:
* Язык программы Visual С++.
* Математическая постановка задачи:
Дано: Система линейных уравнений
a11x0 + a12x1 + ... + a1nxn = b1 ,
a21x0 + a22x1 + ... + a2nxn = b2 ,
. . . . . . . . . . . . .
an1x0 + an2x1 + ... + annxn = bn
Найти: корни данной системы используя метод Гаусса для систем линейных уравнений с выбором главного элемента.
* Математическое решение:
Метод Гаусса с выбором главного элемента по всей матрице (схема полного выбора). В этой схеме допускается нарушение естественного порядка исключения неизвестных.
На 1-м шаге метода среди элементов aij определяют максимальный по модулю элемент ai1j1. Первое уравнение системы и уравнение с номером i1 меняют местами. Далее стандартным образом производят исключение неизвестного xi1 из всех уравнений, кроме первого.
На k-м шаге метода среди коэффициентов aij(k-1) при неизвестных в уравнениях системы с номерами i = k, ..., n выбирают максимальный по модулю коэффициент aikjk(k-1). Затем k-е уравнение и уравнение, содержащее найденный коэффициент, меняют местами и исключают неизвестное xjk из уравнений с номерами i = k + 1, ..., n.
На этапе обратного хода неизвестные вычисляют в следующем порядке: xjn, xjn-1, ..., xj1.
IV. Текст программы
Файл Form.h
#pragma once
int n;
int i, j, m, k;
double aa, bb;
double a[6][7];
#include <locale>
#include <iostream>
namespace My2 {
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>
/// Сводка для Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: добавьте код конструктора
//
}
protected:
/// <summary>
/// Освободить все используемые ресурсы.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Panel^ panel1;
protected: private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::GroupBox^ groupBox1;
private: System::Windows::Forms::TextBox^ b6;
private: System::Windows::Forms::Label^ label32;
private: System::Windows::Forms::TextBox^ a66;
private: System::Windows::Forms::Label^ label33;
private: System::Windows::Forms::TextBox^ a65;
private: System::Windows::Forms::Label^ label34;
private: System::Windows::Forms::TextBox^ a64;
private: System::Windows::Forms::Label^ label35;
private: System::Windows::Forms::TextBox^ a63;
private: System::Windows::Forms::Label^ label36;
private: System::Windows::Forms::TextBox^ a62;
private: System::Windows::Forms::Label^ label37;
private: System::Windows::Forms::TextBox^ a61;
private: System::Windows::Forms::TextBox^ b5;
private: System::Windows::Forms::Label^ label26;
private: System::Windows::Forms::TextBox^ a56;
private: System::Windows::Forms::Label^ label27;
private: System::Windows::Forms::TextBox^ a55;
private: System::Windows::Forms::Label^ label28;
private: System::Windows::Forms::TextBox^ a54;
private: System::Windows::Forms::Label^ label29;
private: System::Windows::Forms::TextBox^ a53;
private: System::Windows::Forms::Label^ label30;
private: System::Windows::Forms::TextBox^ a52;
private: System::Windows::Forms::Label^ label31;
private: System::Windows::Forms::TextBox^ a51;
private: System::Windows::Forms::TextBox^ b4;
private: System::Windows::Forms::Label^ label20;
private: System::Windows::Forms::TextBox^ a46;
private: System::Windows::Forms::Label^ label21;
private: System::Windows::Forms::TextBox^ a45;
private: System::Windows::Forms::Label^ label22;
private: System::Windows::Forms::TextBox^ a44;
private: System::Windows::Forms::Label^ label23;
private: System::Windows::Forms::TextBox^ a43;
private: System::Windows::Forms::Label^ label24;
private: System::Windows::Forms::TextBox^ a42;
private: System::Windows::Forms::Label^ label25;
private: System::Windows::Forms::TextBox^ a41;
private: System::Windows::Forms::TextBox^ b3;
private: System::Windows::Forms::Label^ label14;
private: System::Windows::Forms::TextBox^ a36;
private: System::Windows::Forms::Label^ label15;
private: System::Windows::Forms::TextBox^ a35;
private: System::Windows::Forms::Label^ label16;
private: System::Windows::Forms::TextBox^ a34;
private: System::Windows::Forms::Label^ label17;
private: System::Windows::Forms::TextBox^ a33;
private: System::Windows::Forms::Label^ label18;
private: System::Windows::Forms::TextBox^ a32;
private: System::Windows::Forms::Label^ label19;
private: System::Windows::Forms::TextBox^ a31;
private: System::Windows::Forms::TextBox^ b2;
private: System::Windows::Forms::Label^ label8;
private: System::Windows::Forms::TextBox^ a26;
private: System::Windows::Forms::Label^ label9;
private: System::Windows::Forms::TextBox^ a25;
private: System::Windows::Forms::Label^ label10;
private: System::Windows::Forms::TextBox^ a24;
private: System::Windows::Forms::Label^ label11;
private: System::Windows::Forms::TextBox^ a23;
private: System::Windows::Forms::Label^ label12;
private: System::Windows::Forms::TextBox^ a22;
private: System::Windows::Forms::Label^ label13;
private: System::Windows::Forms::TextBox^ a21;
private: System::Windows::Forms::TextBox^ b1;
private: System::Windows::Forms::Label^ label7;
private: System::Windows::Forms::TextBox^ a16;
private: System::Windows::Forms::Label^ label6;
private: System::Windows::Forms::TextBox^ a15;
private: System::Windows::Forms::Label^ label5;
private: System::Windows::Forms::TextBox^ a14;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::TextBox^ a13;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::TextBox^ a12;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::TextBox^ a11;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::GroupBox^ groupBox2;
private: System::Windows::Forms::ListBox^ listBox1;
private:
/// <summary>
/// Требуется переменная конструктора.
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// Обязательный метод для поддержки конструктора - не изменяйте
/// содержимое данного метода при помощи редактора кода.
/// </summary>
void InitializeComponent(void)
{
this->panel1 = (gcnew System::Windows::Forms::Panel());
this->button1 = (gcnew System::Windows::Forms::Button());
this->label1 = (gcnew System::Windows::Forms::Label());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
this->b6 = (gcnew System::Windows::Forms::TextBox());
this->label32 = (gcnew System::Windows::Forms::Label());
this->a66 = (gcnew System::Windows::Forms::TextBox());
this->label33 = (gcnew System::Windows::Forms::Label());
this->a65 = (gcnew System::Windows::Forms::TextBox());
this->label34 = (gcnew System::Windows::Forms::Label());
this->a64 = (gcnew System::Windows::Forms::TextBox());
this->label35 = (gcnew System::Windows::Forms::Label());
this->a63 = (gcnew System::Windows::Forms::TextBox());
this->label36 = (gcnew System::Windows::Forms::Label());
this->a62 = (gcnew System::Windows::Forms::TextBox());
this->label37 = (gcnew System::Windows::Forms::Label());
this->a61 = (gcnew System::Windows::Forms::TextBox());
this->b5 = (gcnew System::Windows::Forms::TextBox());
this->label26 = (gcnew System::Windows::Forms::Label());
this->a56 = (gcnew System::Windows::Forms::TextBox());
this->label27 = (gcnew System::Windows::Forms::Label());
this->a55 = (gcnew System::Windows::Forms::TextBox());
this->label28 = (gcnew System::Windows::Forms::Label());
this->a54 = (gcnew System::Windows::Forms::TextBox());
this->label29 = (gcnew System::Windows::Forms::Label());
this->a53 = (gcnew System::Windows::Forms::TextBox());
this->label30 = (gcnew System::Windows::Forms::Label());
this->a52 = (gcnew System::Windows::Forms::TextBox());
this->label31 = (gcnew System::Windows::Forms::Label());
this->a51 = (gcnew System::Windows::Forms::TextBox());
this->b4 = (gcnew System::Windows::Forms::TextBox());
this->label20 = (gcnew System::Windows::Forms::Label());
this->a46 = (gcnew System::Windows::Forms::TextBox());
this->label21 = (gcnew System::Windows::Forms::Label());
this->a45 = (gcnew System::Windows::Forms::TextBox());
this->label22 = (gcnew System::Windows::Forms::Label());
this->a44 = (gcnew System::Windows::Forms::TextBox());
this->label23 = (gcnew System::Windows::Forms::Label());
this->a43 = (gcnew System::Windows::Forms::TextBox());
this->label24 = (gcnew System::Windows::Forms::Label());
this->a42 = (gcnew System::Windows::Forms::TextBox());
this->label25 = (gcnew System::Windows::Forms::Label());
this->a41 = (gcnew System::Windows::Forms::TextBox());
this->b3 = (gcnew System::Windows::Forms::TextBox());
this->label14 = (gcnew System::Windows::Forms::Label());
this->a36 = (gcnew System::Windows::Forms::TextBox());
this->label15 = (gcnew System::Windows::Forms::Label());
this->a35 = (gcnew System::Windows::Forms::TextBox());
this->label16 = (gcnew System::Windows::Forms::Label());
this->a34 = (gcnew System::Windows::Forms::TextBox());
this->label17 = (gcnew System::Windows::Forms::Label());
this->a33 = (gcnew System::Windows::Forms::TextBox());
this->label18 = (gcnew System::Windows::Forms::Label());
this->a32 = (gcnew System::Windows::Forms::TextBox());
this->label19 = (gcnew System::Windows::Forms::Label());
this->a31 = (gcnew System::Windows::Forms::TextBox());
this->b2 = (gcnew System::Windows::Forms::TextBox());
this->label8 = (gcnew System::Windows::Forms::Label());
this->a26 = (gcnew System::Windows::Forms::TextBox());
this->label9 = (gcnew System::Windows::Forms::Label());
this->a25 = (gcnew System::Windows::Forms::TextBox());
this->label10 = (gcnew System::Windows::Forms::Label());
this->a24 = (gcnew System::Windows::Forms::TextBox());
this->label11 = (gcnew System::Windows::Forms::Label());
this->a23 = (gcnew System::Windows::Forms::TextBox());
this->label12 = (gcnew System::Windows::Forms::Label());
this->a22 = (gcnew System::Windows::Forms::TextBox());
this->label13 = (gcnew System::Windows::Forms::Label());
this->a21 = (gcnew System::Windows::Forms::TextBox());
this->b1 = (gcnew System::Windows::Forms::TextBox());
this->label7 = (gcnew System::Windows::Forms::Label());
this->a16 = (gcnew System::Windows::Forms::TextBox());
this->label6 = (gcnew System::Windows::Forms::Label());
this->a15 = (gcnew System::Windows::Forms::TextBox());
this->label5 = (gcnew System::Windows::Forms::Label());
this->a14 = (gcnew System::Windows::Forms::TextBox());
this->label4 = (gcnew System::Windows::Forms::Label());
this->a13 = (gcnew System::Windows::Forms::TextBox());
this->label3 = (gcnew System::Windows::Forms::Label());
this->a12 = (gcnew System::Windows::Forms::TextBox());
this->label2 = (gcnew System::Windows::Forms::Label());
this->a11 = (gcnew System::Windows::Forms::TextBox());
this->button2 = (gcnew System::Windows::Forms::Button());
this->groupBox2 = (gcnew System::Windows::Forms::GroupBox());
this->listBox1 = (gcnew System::Windows::Forms::ListBox());
this->panel1->SuspendLayout();
this->groupBox1->SuspendLayout();
this->groupBox2->SuspendLayout();
this->SuspendLayout();
// // panel1
// this->panel1->Controls->Add(this->groupBox2);
this->panel1->Dock = System::Windows::Forms::DockStyle::Bottom;
this->panel1->Location = System::Drawing::Point(0, 263);
this->panel1->Name = L"panel1";
this->panel1->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
this->panel1->Size = System::Drawing::Size(584, 143);
this->panel1->TabIndex = 0;
// // button1
// this->button1->Location = System::Drawing::Point(327, 25);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 30);
this->button1->TabIndex = 0;
this->button1->Text = L"Считать";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
// // label1
// this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(12, 9);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(150, 13);
this->label1->TabIndex = 1;
this->label1->Text = L"Количество столбцов/строк";
// // textBox1
// this->textBox1->Location = System::Drawing::Point(15, 25);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(147, 20);
this->textBox1->TabIndex = 2;
this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::Form1_Load);
// // groupBox1
// this->groupBox1->Controls->Add(this->b6);
this->groupBox1->Controls->Add(this->label32);
this->groupBox1->Controls->Add(this->a66);
this->groupBox1->Controls->Add(this->label33);
this->groupBox1->Controls->Add(this->a65);
this->groupBox1->Controls->Add(this->label34);
this->groupBox1->Controls->Add(this->a64);
this->groupBox1->Controls->Add(this->label35);
this->groupBox1->Controls->Add(this->a63);
this->groupBox1->Controls->Add(this->label36);
this->groupBox1->Controls->Add(this->a62);
this->groupBox1->Controls->Add(this->label37);
this->groupBox1->Controls->Add(this->a61);
this->groupBox1->Controls->Add(this->b5);
this->groupBox1->Controls->Add(this->label26);
this->groupBox1->Controls->Add(this->a56);
this->groupBox1->Controls->Add(this->label27);
this->groupBox1->Controls->Add(this->a55);
this->groupBox1->Controls->Add(this->label28);
this->groupBox1->Controls->Add(this->a54);
this->groupBox1->Controls->Add(this->label29);
this->groupBox1->Controls->Add(this->a53);
this->groupBox1->Controls->Add(this->label30);
this->groupBox1->Controls->Add(this->a52);
this->groupBox1->Controls->Add(this->label31);
this->groupBox1->Controls->Add(this->a51);
this->groupBox1->Controls->Add(this->b4);
this->groupBox1->Controls->Add(this->label20);
this->groupBox1->Controls->Add(this->a46);
this->groupBox1->Controls->Add(this->label21);
this->groupBox1->Controls->Add(this->a45);
this->groupBox1->Controls->Add(this->label22);
this->groupBox1->Controls->Add(this->a44);
this->groupBox1->Controls->Add(this->label23);
this->groupBox1->Controls->Add(this->a43);
this->groupBox1->Controls->Add(this->label24);
this->groupBox1->Controls->Add(this->a42);
this->groupBox1->Controls->Add(this->label25);
this->groupBox1->Controls->Add(this->a41);
this->groupBox1->Controls->Add(this->b3);
this->groupBox1->Controls->Add(this->label14);
this->groupBox1->Controls->Add(this->a36);
this->groupBox1->Controls->Add(this->label15);
this->groupBox1->Controls->Add(this->a35);
this->groupBox1->Controls->Add(this->label16);
this->groupBox1->Controls->Add(this->a34);
this->groupBox1->Controls->Add(this->label17);
this->groupBox1->Controls->Add(this->a33);
this->groupBox1->Controls->Add(this->label18);
this->groupBox1->Controls->Add(this->a32);
this->groupBox1->Controls->Add(this->label19);
this->groupBox1->Controls->Add(this->a31);
this->groupBox1->Controls->Add(this->b2);
this->groupBox1->Controls->Add(this->label8);
this->groupBox1->Controls->Add(this->a26);
this->groupBox1->Controls->Add(this->label9);
this->groupBox1->Controls->Add(this->a25);
this->groupBox1->Controls->Add(this->label10);
this->groupBox1->Controls->Add(this->a24);
this->groupBox1->Controls->Add(this->label11);
this->groupBox1->Controls->Add(this->a23);
this->groupBox1->Controls->Add(this->label12);
this->groupBox1->Controls->Add(this->a22);
this->groupBox1->Controls->Add(this->label13);
this->groupBox1->Controls->Add(this->a21);
this->groupBox1->Controls->Add(this->b1);
this->groupBox1->Controls->Add(this->label7);
this->groupBox1->Controls->Add(this->a16);
this->groupBox1->Controls->Add(this->label6);
this->groupBox1->Controls->Add(this->a15);
this->groupBox1->Controls->Add(this->label5);
this->groupBox1->Controls->Add(this->a14);
this->groupBox1->Controls->Add(this->label4);
this->groupBox1->Controls->Add(this->a13);
this->groupBox1->Controls->Add(this->label3);
this->groupBox1->Controls->Add(this->a12);
this->groupBox1->Controls->Add(this->label2);
this->groupBox1->Controls->Add(this->a11);
this->groupBox1->Location = System::Drawing::Point(15, 66);
this->groupBox1->Name = L"groupBox1";
this->groupBox1->Size = System::Drawing::Size(543, 191);
this->groupBox1->TabIndex = 3;
this->groupBox1->TabStop = false;
this->groupBox1->Text = L"Коэффициенты";
// // b6
// this->b6->Location = System::Drawing::Point(438, 149);
this->b6->Name = L"b6";
this->b6->Size = System::Drawing::Size(30, 20);
this->b6->TabIndex = 77;
// // label32
// this->label32->AutoSize = true;
this->label32->Location = System::Drawing::Point(402, 152);
this->label32->Name = L"label32";
this->label32->Size = System::Drawing::Size(30, 13);
this->label32->TabIndex = 76;
this->label32->Text = L"x6 = ";
// // a66
// this->a66->Location = System::Drawing::Point(366, 149);
this->a66->Name = L"a66";
this->a66->Size = System::Drawing::Size(30, 20);
this->a66->TabIndex = 75;
// // label33
// this->label33->AutoSize = true;
this->label33->Location = System::Drawing::Point(330, 152);
this->label33->Name = L"label33";
this->label33->Size = System::Drawing::Size(30, 13);
this->label33->TabIndex = 74;
this->label33->Text = L"x5 + ";
// // a65
// this->a65->Location = System::Drawing::Point(294, 149);
this->a65->Name = L"a65";
this->a65->Size = System::Drawing::Size(30, 20);
this->a65->TabIndex = 73;
// // label34
// this->label34->AutoSize = true;
this->label34->Location = System::Drawing::Point(258, 152);
this->label34->Name = L"label34";
this->label34->Size = System::Drawing::Size(30, 13);
this->label34->TabIndex = 72;
this->label34->Text = L"x4 + ";
// // a64
// this->a64->Location = System::Drawing::Point(222, 149);
this->a64->Name = L"a64";
this->a64->Size = System::Drawing::Size(30, 20);
this->a64->TabIndex = 71;
// // label35
// this->label35->AutoSize = true;
this->label35->Location = System::Drawing::Point(186, 152);
this->label35->Name = L"label35";
this->label35->Size = System::Drawing::Size(30, 13);
this->label35->TabIndex = 70;
this->label35->Text = L"x3 + ";
// // a63
// this->a63->Location = System::Drawing::Point(150, 149);
this->a63->Name = L"a63";
this->a63->Size = System::Drawing::Size(30, 20);
this->a63->TabIndex = 69;
// // label36
// this->label36->AutoSize = true;
this->label36->Location = System::Drawing::Point(114, 152);
this->label36->Name = L"label36";
this->label36->Size = System::Drawing::Size(30, 13);
this->label36->TabIndex = 68;
this->label36->Text = L"x2 + ";
// // a62
// this->a62->Location = System::Drawing::Point(78, 149);
this->a62->Name = L"a62";
this->a62->Size = System::Drawing::Size(30, 20);
this->a62->TabIndex = 67;
// // label37
// this->label37->AutoSize = true;
this->label37->Location = System::Drawing::Point(42, 152);
this->label37->Name = L"label37";
this->label37->Size = System::Drawing::Size(30, 13);
this->label37->TabIndex = 66;
this->label37->Text = L"x1 + ";
// // a61
// this->a61->Location = System::Drawing::Point(6, 149);
this->a61->Name = L"a61";
this->a61->Size = System::Drawing::Size(30, 20);
this->a61->TabIndex = 65;
// // b5
// this->b5->Location = System::Drawing::Point(438, 123);
this->b5->Name = L"b5";
this->b5->Size = System::Drawing::Size(30, 20);
this->b5->TabIndex = 64;
// // label26
// this->label26->AutoSize = true;
this->label26->Location = System::Drawing::Point(402, 126);
this->label26->Name = L"label26";
this->label26->Size = System::Drawing::Size(30, 13);
this->label26->TabIndex = 63;
this->label26->Text = L"x6 = ";
// // a56
// this->a56->Location = System::Drawing::Point(366, 123);
this->a56->Name = L"a56";
this->a56->Size = System::Drawing::Size(30, 20);
this->a56->TabIndex = 62;
// // label27
// this->label27->AutoSize = true;
this->label27->Location = System::Drawing::Point(330, 126);
this->label27->Name = L"label27";
this->label27->Size = System::Drawing::Size(30, 13);
this->label27->TabIndex = 61;
this->label27->Text = L"x5 + ";
// // a55
// this->a55->Location = System::Drawing::Point(294, 123);
this->a55->Name = L"a55";
this->a55->Size = System::Drawing::Size(30, 20);
this->a55->TabIndex = 60;
// // label28
// this->label28->AutoSize = true;
this->label28->Location = System::Drawing::Point(258, 126);
this->label28->Name = L"label28";
this->label28->Size = System::Drawing::Size(30, 13);
this->label28->TabIndex = 59;
this->label28->Text = L"x4 + ";
// // a54
// this->a54->Location = System::Drawing::Point(222, 123);
this->a54->Name = L"a54";
this->a54->Size = System::Drawing::Size(30, 20);
this->a54->TabIndex = 58;
// // label29
// this->label29->AutoSize = true;
this->label29->Location = System::Drawing::Point(186, 126);
this->label29->Name = L"label29";
this->label29->Size = System::Drawing::Size(30, 13);
this->label29->TabIndex = 57;
this->label29->Text = L"x3 + ";
// // a53
// this->a53->Location = System::Drawing::Point(150, 123);
this->a53->Name = L"a53";
this->a53->Size = System::Drawing::Size(30, 20);
this->a53->TabIndex = 56;
// // label30
// this->label30->AutoSize = true;
this->label30->Location = System::Drawing::Point(114, 126);
this->label30->Name = L"label30";
this->label30->Size = System::Drawing::Size(30, 13);
this->label30->TabIndex = 55;
this->label30->Text = L"x2 + ";
// // a52
// this->a52->Location = System::Drawing::Point(78, 123);
this->a52->Name = L"a52";
this->a52->Size = System::Drawing::Size(30, 20);
this->a52->TabIndex = 54;
// // label31
// this->label31->AutoSize = true;
this->label31->Location = System::Drawing::Point(42, 126);
this->label31->Name = L"label31";
this->label31->Size = System::Drawing::Size(30, 13);
this->label31->TabIndex = 53;
this->label31->Text = L"x1 + ";
// // a51
// this->a51->Location = System::Drawing::Point(6, 123);
this->a51->Name = L"a51";
this->a51->Size = System::Drawing::Size(30, 20);
this->a51->TabIndex = 52;
this->a51->TextChanged += gcnew System::EventHandler(this, &Form1::textBox29_TextChanged);
// // b4
// this->b4->Location = System::Drawing::Point(438, 97);
this->b4->Name = L"b4";
this->b4->Size = System::Drawing::Size(30, 20);
this->b4->TabIndex = 51;
// // label20
// this->label20->AutoSize = true;
this->label20->Location = System::Drawing::Point(402, 100);
this->label20->Name = L"label20";
this->label20->Size = System::Drawing::Size(30, 13);
this->label20->TabIndex = 50;
this->label20->Text = L"x6 = ";
// // a46
// this->a46->Location = System::Drawing::Point(366, 97);
this->a46->Name = L"a46";
this->a46->Size = System::Drawing::Size(30, 20);
this->a46->TabIndex = 49;
// // label21
// this->label21->AutoSize = true;
this->label21->Location = System::Drawing::Point(330, 100);
this->label21->Name = L"label21";
this->label21->Size = System::Drawing::Size(30, 13);
this->label21->TabIndex = 48;
this->label21->Text = L"x5 + ";
// // a45
// this->a45->Location = System::Drawing::Point(294, 97);
this->a45->Name = L"a45";
this->a45->Size = System::Drawing::Size(30, 20);
this->a45->TabIndex = 47;
// // label22
// this->label22->AutoSize = true;
this->label22->Location = System::Drawing::Point(258, 100);
this->label22->Name = L"label22";
this->label22->Size = System::Drawing::Size(30, 13);
this->label22->TabIndex = 46;
this->label22->Text = L"x4 + ";
// // a44
// this->a44->Location = System::Drawing::Point(222, 97);
this->a44->Name = L"a44";
this->a44->Size = System::Drawing::Size(30, 20);
this->a44->TabIndex = 45;
// // label23
// this->label23->AutoSize = true;
this->label23->Location = System::Drawing::Point(186, 100);
this->label23->Name = L"label23";
this->label23->Size = System::Drawing::Size(30, 13);
this->label23->TabIndex = 44;
this->label23->Text = L"x3 + ";
// // a43
// this->a43->Location = System::Drawing::Point(150, 97);
this->a43->Name = L"a43";
this->a43->Size = System::Drawing::Size(30, 20);
this->a43->TabIndex = 43;
// // label24
// this->label24->AutoSize = true;
this->label24->Location = System::Drawing::Point(114, 100);
this->label24->Name = L"label24";
this->label24->Size = System::Drawing::Size(30, 13);
this->label24->TabIndex = 42;
this->label24->Text = L"x2 + ";
// // a42
// this->a42->Location = System::Drawing::Point(78, 97);
this->a42->Name = L"a42";
this->a42->Size = System::Drawing::Size(30, 20);
this->a42->TabIndex = 41;
// // label25
// this->label25->AutoSize = true;
this->label25->Location = System::Drawing::Point(42, 100);
this->label25->Name = L"label25";
this->label25->Size = System::Drawing::Size(30, 13);
this->label25->TabIndex = 40;
this->label25->Text = L"x1 + ";
// // a41
// this->a41->Location = System::Drawing::Point(6, 97);
this->a41->Name = L"a41";
this->a41->Size = System::Drawing::Size(30, 20);
this->a41->TabIndex = 39;
// // b3
// this->b3->Location = System::Drawing::Point(438, 71);
this->b3->Name = L"b3";
this->b3->Size = System::Drawing::Size(30, 20);
this->b3->TabIndex = 38;
// // label14
// this->label14->AutoSize = true;
this->label14->Location = System::Drawing::Point(402, 74);
this->label14->Name = L"label14";
this->label14->Size = System::Drawing::Size(30, 13);
this->label14->TabIndex = 37;
this->label14->Text = L"x6 = ";
// // a36
// this->a36->Location = System::Drawing::Point(366, 71);
this->a36->Name = L"a36";
this->a36->Size = System::Drawing::Size(30, 20);
this->a36->TabIndex = 36;
// // label15
// this->label15->AutoSize = true;
this->label15->Location = System::Drawing::Point(330, 74);
this->label15->Name = L"label15";
this->label15->Size = System::Drawing::Size(30, 13);
this->label15->TabIndex = 35;
this->label15->Text = L"x5 + ";
// // a35
// this->a35->Location = System::Drawing::Point(294, 71);
this->a35->Name = L"a35";
this->a35->Size = System::Drawing::Size(30, 20);
this->a35->TabIndex = 34;
// // label16
// this->label16->AutoSize = true;
this->label16->Location = System::Drawing::Point(258, 74);
this->label16->Name = L"label16";
this->label16->Size = System::Drawing::Size(30, 13);
this->label16->TabIndex = 33;
this->label16->Text = L"x4 + ";
// // a34
// this->a34->Location = System::Drawing::Point(222, 71);
this->a34->Name = L"a34";
this->a34->Size = System::Drawing::Size(30, 20);
this->a34->TabIndex = 32;
// // label17
// this->label17->AutoSize = true;
this->label17->Location = System::Drawing::Point(186, 74);
this->label17->Name = L"label17";
this->label17->Size = System::Drawing::Size(30, 13);
this->label17->TabIndex = 31;
this->label17->Text = L"x3 + ";
// // a33
// this->a33->Location = System::Drawing::Point(150, 71);
this->a33->Name = L"a33";
this->a33->Size = System::Drawing::Size(30, 20);
this->a33->TabIndex = 30;
// // label18
// this->label18->AutoSize = true;
this->label18->Location = System::Drawing::Point(114, 74);
this->label18->Name = L"label18";
this->label18->Size = System::Drawing::Size(30, 13);
this->label18->TabIndex = 29;
this->label18->Text = L"x2 + ";
// // a32
// this->a32->Location = System::Drawing::Point(78, 71);
this->a32->Name = L"a32";
this->a32->Size = System::Drawing::Size(30, 20);
this->a32->TabIndex = 28;
// // label19
// this->label19->AutoSize = true;
this->label19->Location = System::Drawing::Point(42, 74);
this->label19->Name = L"label19";
this->label19->Size = System::Drawing::Size(30, 13);
this->label19->TabIndex = 27;
this->label19->Text = L"x1 + ";
// // a31
// this->a31->Location = System::Drawing::Point(6, 71);
this->a31->Name = L"a31";
this->a31->Size = System::Drawing::Size(30, 20);
this->a31->TabIndex = 26;
// // b2
// this->b2->Location = System::Drawing::Point(438, 45);
this->b2->Name = L"b2";
this->b2->Size = System::Drawing::Size(30, 20);
this->b2->TabIndex = 25;
// // label8
// this->label8->AutoSize = true;
this->label8->Location = System::Drawing::Point(402, 48);
this->label8->Name = L"label8";
this->label8->Size = System::Drawing::Size(30, 13);
this->label8->TabIndex = 24;
this->label8->Text = L"x6 = ";
// // a26
// this->a26->Location = System::Drawing::Point(366, 45);
this->a26->Name = L"a26";
this->a26->Size = System::Drawing::Size(30, 20);
this->a26->TabIndex = 23;
// // label9
// this->label9->AutoSize = true;
this->label9->Location = System::Drawing::Point(330, 48);
this->label9->Name = L"label9";
this->label9->Size = System::Drawing::Size(30, 13);
this->label9->TabIndex = 22;
this->label9->Text = L"x5 + ";
// // a25
// this->a25->Location = System::Drawing::Point(294, 45);
this->a25->Name = L"a25";
this->a25->Size = System::Drawing::Size(30, 20);
this->a25->TabIndex = 21;
// // label10
// this->label10->AutoSize = true;
this->label10->Location = System::Drawing::Point(258, 48);
this->label10->Name = L"label10";
this->label10->Size = System::Drawing::Size(30, 13);
this->label10->TabIndex = 20;
this->label10->Text = L"x4 + ";
// // a24
// this->a24->Location = System::Drawing::Point(222, 45);
this->a24->Name = L"a24";
this->a24->Size = System::Drawing::Size(30, 20);
this->a24->TabIndex = 19;
// // label11
// this->label11->AutoSize = true;
this->label11->Location = System::Drawing::Point(186, 48);
this->label11->Name = L"label11";
this->label11->Size = System::Drawing::Size(30, 13);
this->label11->TabIndex = 18;
this->label11->Text = L"x3 + ";
// // a23
// this->a23->Location = System::Drawing::Point(150, 45);
this->a23->Name = L"a23";
this->a23->Size = System::Drawing::Size(30, 20);
this->a23->TabIndex = 17;
// // label12
// this->label12->AutoSize = true;
this->label12->Location = System::Drawing::Point(114, 48);
this->label12->Name = L"label12";
this->label12->Size = System::Drawing::Size(30, 13);
this->label12->TabIndex = 16;
this->label12->Text = L"x2 + ";
// // a22
// this->a22->Location = System::Drawing::Point(78, 45);
this->a22->Name = L"a22";
this->a22->Size = System::Drawing::Size(30, 20);
this->a22->TabIndex = 15;
// // label13
// this->label13->AutoSize = true;
this->label13->Location = System::Drawing::Point(42, 48);
this->label13->Name = L"label13";
this->label13->Size = System::Drawing::Size(30, 13);
this->label13->TabIndex = 14;
this->label13->Text = L"x1 + ";
// // a21
// this->a21->Location = System::Drawing::Point(6, 45);
this->a21->Name = L"a21";
this->a21->Size = System::Drawing::Size(30, 20);
this->a21->TabIndex = 13;
// // b1
// this->b1->Location = System::Drawing::Point(438, 19);
this->b1->Name = L"b1";
this->b1->Size = System::Drawing::Size(30, 20);
this->b1->TabIndex = 12;
// // label7
// this->label7->AutoSize = true;
this->label7->Location = System::Drawing::Point(402, 22);
this->label7->Name = L"label7";
this->label7->Size = System::Drawing::Size(30, 13);
this->label7->TabIndex = 11;
this->label7->Text = L"x6 = ";
// // a16
// this->a16->Location = System::Drawing::Point(366, 19);
this->a16->Name = L"a16";
this->a16->Size = System::Drawing::Size(30, 20);
this->a16->TabIndex = 10;
// // label6
// this->label6->AutoSize = true;
this->label6->Location = System::Drawing::Point(330, 22);
this->label6->Name = L"label6";
this->label6->Size = System::Drawing::Size(30, 13);
this->label6->TabIndex = 9;
this->label6->Text = L"x5 + ";
// // a15
// this->a15->Location = System::Drawing::Point(294, 19);
this->a15->Name = L"a15";
this->a15->Size = System::Drawing::Size(30, 20);
this->a15->TabIndex = 8;
// // label5
// this->label5->AutoSize = true;
this->label5->Location = System::Drawing::Point(258, 22);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(30, 13);
this->label5->TabIndex = 7;
this->label5->Text = L"x4 + ";
// // a14
// this->a14->Location = System::Drawing::Point(222, 19);
this->a14->Name = L"a14";
this->a14->Size = System::Drawing::Size(30, 20);
this->a14->TabIndex = 6;
// // label4
// this->label4->AutoSize = true;
this->label4->Location = System::Drawing::Point(186, 22);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(30, 13);
this->label4->TabIndex = 5;
this->label4->Text = L"x3 + ";
// // a13
// this->a13->Location = System::Drawing::Point(150, 19);
this->a13->Name = L"a13";
this->a13->Size = System::Drawing::Size(30, 20);
this->a13->TabIndex = 4;
// // label3
// this->label3->AutoSize = true;
this->label3->Location = System::Drawing::Point(114, 22);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(30, 13);
this->label3->TabIndex = 3;
this->label3->Text = L"x2 + ";
// // a12
// this->a12->Location = System::Drawing::Point(78, 19);
this->a12->Name = L"a12";
this->a12->Size = System::Drawing::Size(30, 20);
this->a12->TabIndex = 2;
// // label2
// this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(42, 22);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(30, 13);
this->label2->TabIndex = 1;
this->label2->Text = L"x1 + ";
// // a11
// this->a11->Location = System::Drawing::Point(6, 19);
this->a11->Name = L"a11";
this->a11->Size = System::Drawing::Size(30, 20);
this->a11->TabIndex = 0;
// // button2
// this->button2->Location = System::Drawing::Point(192, 25);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(111, 30);
this->button2->TabIndex = 4;
this->button2->Text = L"Показать сетку";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
// // groupBox2
// this->groupBox2->Controls->Add(this->listBox1);
this->groupBox2->Location = System::Drawing::Point(3, 1);
this->groupBox2->Name = L"groupBox2";
this->groupBox2->RightToLeft = System::Windows::Forms::RightToLeft::No;
this->groupBox2->Size = System::Drawing::Size(264, 141);
this->groupBox2->TabIndex = 0;
this->groupBox2->TabStop = false;
this->groupBox2->Text = L"Решение";
// // listBox1
// this->listBox1->FormattingEnabled = true;
this->listBox1->Location = System::Drawing::Point(6, 14);
this->listBox1->Name = L"listBox1";
this->listBox1->RightToLeft = System::Windows::Forms::RightToLeft::No;
this->listBox1->Size = System::Drawing::Size(249, 121);
this->listBox1->TabIndex = 1;
// // Form1
// this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(584, 406);
this->Controls->Add(this->button1);
this->Controls->Add(this->button2);
this->Controls->Add(this->groupBox1);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->label1);
this->Controls->Add(this->panel1);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->panel1->ResumeLayout(false);
this->groupBox1->ResumeLayout(false);
this->groupBox1->PerformLayout();
this->groupBox2->ResumeLayout(false);
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
if (n == 2)
{
a[0][0] = Convert::ToDouble(a11->Text);
a[0][1] = Convert::ToDouble(a12->Text);
a[1][0] = Convert::ToDouble(a21->Text);
a[1][1] = Convert::ToDouble(a22->Text);
a[0][2] = Convert::ToDouble(b1->Text);
a[1][2] = Convert::ToDouble(b2->Text);
}
if (n == 3)
{
a[0][0] = Convert::ToDouble(a11->Text);
a[0][1] = Convert::ToDouble(a12->Text);
a[0][2] = Convert::ToDouble(a13->Text);
a[1][0] = Convert::ToDouble(a21->Text);
a[1][1] = Convert::ToDouble(a22->Text);
a[1][2] = Convert::ToDouble(a23->Text);
a[2][0] = Convert::ToDouble(a31->Text);
a[2][1] = Convert::ToDouble(a32->Text);
a[2][2] = Convert::ToDouble(a33->Text);
a[0][3] = Convert::ToDouble(b1->Text);
a[1][3] = Convert::ToDouble(b2->Text);
a[2][3] = Convert::ToDouble(b3->Text);
}
if (n == 4)
{
a[0][0] = Convert::ToDouble(a11->Text);
a[0][1] = Convert::ToDouble(a12->Text);
a[0][2] = Convert::ToDouble(a13->Text);
a[0][3] = Convert::ToDouble(a14->Text);
a[1][0] = Convert::ToDouble(a21->Text);
a[1][1] = Convert::ToDouble(a22->Text);
a[1][2] = Convert::ToDouble(a23->Text);
a[1][3] = Convert::ToDouble(a24->Text);
a[2][0] = Convert::ToDouble(a31->Text);
a[2][1] = Convert::ToDouble(a32->Text);
a[2][2] = Convert::ToDouble(a33->Text);
a[2][3] = Convert::ToDouble(a34->Text);
a[3][0] = Convert::ToDouble(a41->Text);
a[3][1] = Convert::ToDouble(a42->Text);
a[3][2] = Convert::ToDouble(a43->Text);
a[3][3] = Convert::ToDouble(a44->Text);
a[0][4] = Convert::ToDouble(b1->Text);
a[1][4] = Convert::ToDouble(b2->Text);
a[2][4] = Convert::ToDouble(b3->Text);
a[3][4] = Convert::ToDouble(b4->Text);
}
if (n == 5)
{
a[0][0] = Convert::ToDouble(a11->Text);
a[0][1] = Convert::ToDouble(a12->Text);
a[0][2] = Convert::ToDouble(a13->Text);
a[0][3] = Convert::ToDouble(a14->Text);
a[0][4] = Convert::ToDouble(a15->Text);
a[1][0] = Convert::ToDouble(a21->Text);
a[1][1] = Convert::ToDouble(a22->Text);
a[1][2] = Convert::ToDouble(a23->Text);
a[1][3] = Convert::ToDouble(a24->Text);
a[1][4] = Convert::ToDouble(a25->Text);
a[2][0] = Convert::ToDouble(a31->Text);
a[2][1] = Convert::ToDouble(a32->Text);
a[2][2] = Convert::ToDouble(a33->Text);
a[2][3] = Convert::ToDouble(a34->Text);
a[2][4] = Convert::ToDouble(a35->Text);
a[3][0] = Convert::ToDouble(a41->Text);
a[3][1] = Convert::ToDouble(a42->Text);
a[3][2] = Convert::ToDouble(a43->Text);
a[3][3] = Convert::ToDouble(a44->Text);
a[3][4] = Convert::ToDouble(a45->Text);
a[4][0] = Convert::ToDouble(a51->Text);
a[4][1] = Convert::ToDouble(a52->Text);
a[4][2] = Convert::ToDouble(a53->Text);
a[4][3] = Convert::ToDouble(a54->Text);
a[4][4] = Convert::ToDouble(a55->Text);
a[0][4] = Convert::ToDouble(b1->Text);
a[1][5] = Convert::ToDouble(b2->Text);
a[2][5] = Convert::ToDouble(b3->Text);
a[3][5] = Convert::ToDouble(b4->Text);
a[4][5] = Convert::ToDouble(b5->Text);
}
if (n == 6)
{
a[0][0] = Convert::ToDouble(a11->Text);
a[0][1] = Convert::ToDouble(a12->Text);
a[0][2] = Convert::ToDouble(a13->Text);
a[0][3] = Convert::ToDouble(a14->Text);
a[0][4] = Convert::ToDouble(a15->Text);
a[0][5] = Convert::ToDouble(a16->Text);
a[1][0] = Convert::ToDouble(a21->Text);
a[1][1] = Convert::ToDouble(a22->Text);
a[1][2] = Convert::ToDouble(a23->Text);
a[1][3] = Convert::ToDouble(a24->Text);
a[1][4] = Convert::ToDouble(a25->Text);
a[1][5] = Convert::ToDouble(a26->Text);
a[2][0] = Convert::ToDouble(a31->Text);
a[2][1] = Convert::ToDouble(a32->Text);
a[2][2] = Convert::ToDouble(a33->Text);
a[2][3] = Convert::ToDouble(a34->Text);
a[2][4] = Convert::ToDouble(a35->Text);
a[2][5] = Convert::ToDouble(a36->Text);
a[3][0] = Convert::ToDouble(a41->Text);
a[3][1] = Convert::ToDouble(a42->Text);
a[3][2] = Convert::ToDouble(a43->Text);
a[3][3] = Convert::ToDouble(a44->Text);
a[3][4] = Convert::ToDouble(a45->Text);
a[3][5] = Convert::ToDouble(a46->Text);
a[4][0] = Convert::ToDouble(a51->Text);
a[4][1] = Convert::ToDouble(a52->Text);
a[4][2] = Convert::ToDouble(a53->Text);
a[4][3] = Convert::ToDouble(a54->Text);
a[4][4] = Convert::ToDouble(a55->Text);
a[4][5] = Convert::ToDouble(a56->Text);
a[5][0] = Convert::ToDouble(a61->Text);
a[5][1] = Convert::ToDouble(a62->Text);
a[5][2] = Convert::ToDouble(a63->Text);
a[5][3] = Convert::ToDouble(a64->Text);
a[5][4] = Convert::ToDouble(a65->Text);
a[5][5] = Convert::ToDouble(a66->Text);
a[0][4] = Convert::ToDouble(b1->Text);
a[1][6] = Convert::ToDouble(b2->Text);
a[2][6] = Convert::ToDouble(b3->Text);
a[3][6] = Convert::ToDouble(b4->Text);
a[4][6] = Convert::ToDouble(b5->Text);
a[5][6] = Convert::ToDouble(b6->Text);
}
setlocale(LC_ALL, "Russian");
double* x; x = (double *)malloc(n* sizeof(double));
for (k = 0; k<n; k++) //Поиск максимального элемента в первом столбце
{
aa = abs(a[k][k]);
i = k;
for(m = k+1; m<n; m++)
if(abs(a[m][k])>aa)
{
i = m;
aa = abs(a[m][k]);
}
if (aa == 0) //проверка на нулевой элемент
{
listBox1->Items->Add("Система не имеет решений");
}
if (i != k) // перестановка i-ой строки, содержащей главный элемент k-ой строки
{
for (j=k; j < n+1; j++)
{
bb = a[k][j];
a[k][j] = a[i][j];
a[i][j] = bb;
}
}
aa = a[k][k];//преобразование k-ой строки (Вычисление масштабирующих множителей)
a[k][k] = 1; for (j=k+1;j<n+1;j++) a[k][j] = a[k][j]/aa;
for (i = k+1; i < n; i++)//преобразование строк с помощью k-ой строки
{
bb = a[i][k];
a[i][k] = 0;
if (bb!=0)
for (j=k+1; j< n+1; j++)
a[i][j]=a[i][j]-bb*a[k][j];
}
}
for (i=n-1; i>=0; i--) //Нахождение решений СЛАУ
{
x[i] = 0;
aa = a[i][n];
for (j = n; j>i; j--) aa = aa-a[i][j]*x[j];
x[i] = aa;
}
listBox1->Items->Add("Решение системы:");//вывод решений
for (i = 0; i< n; i++)
{
listBox1->Items->Add("x["+ (i+1) + "]=" + x[i]);
}
}
private: System::Void textBox22_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void textBox29_TextChanged(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
if(Convert::ToDouble(textBox1->Text) == 2)
{
n = 2;
a11->Visible = true;
a12->Visible = true;
a21->Visible = true;
a22->Visible = true;
b1->Visible = true;
b2->Visible = true;
label3->Text = "x2 = ";
label12->Text = "x2 = ";
label2->Visible = true;
label3->Visible = true;
label12->Visible = true;
label13->Visible = true;
b1->Location = System::Drawing::Point(150,19);
b2->Location = System::Drawing::Point(150,45);
}
if(Convert::ToDouble(textBox1->Text) == 3)
{
n = 3;
a11->Visible = true;
a12->Visible = true;
a13->Visible = true;
a21->Visible = true;
a22->Visible = true;
a23->Visible = true;
a31->Visible = true;
a32->Visible = true;
a33->Visible = true;
b1->Visible = true;
b2->Visible = true;
b3->Visible = true;
label4->Text = "x3 = ";
label11->Text = "x3 = ";
label17->Text = "x3 = ";
label2->Visible = true;
label3->Visible = true;
label4->Visible = true;
label11->Visible = true;
label17->Visible = true;
label18->Visible = true;
label19->Visible = true;
label12->Visible = true;
label13->Visible = true;
b1->Location = System::Drawing::Point(222,19);
b2->Location = System::Drawing::Point(222,45);
b3->Location = System::Drawing::Point(222,71);
}
if(Convert::ToDouble(textBox1->Text) == 4)
{
n = 4;
a11->Visible = true;
a12->Visible = true;
a13->Visible = true;
a14->Visible = true;
a21->Visible = true;
a22->Visible = true;
a23->Visible = true;
a24->Visible = true;
a31->Visible = true;
a32->Visible = true;
a33->Visible = true;
a34->Visible = true;
a41->Visible = true;
a42->Visible = true;
a43->Visible = true;
a44->Visible = true;
b1->Visible = true;
b2->Visible = true;
b3->Visible = true;
b4->Visible = true;
label2->Visible = true;
label3->Visible = true;
label4->Visible = true;
label5->Visible = true;
label5->Text = "x4 = ";
label10->Visible = true;
label10->Text = "x4 = ";
label11->Visible = true;
label12->Visible = true;
label13->Visible = true;
label16->Visible = true;
label16->Text = "x4 = ";
label17->Visible = true;
label18->Visible = true;
label19->Visible = true;
label22->Text = "x4 = ";
label22->Visible = true;
label23->Visible = true;
label24->Visible = true;
label25->Visible = true;
b1->Location = System::Drawing::Point(294,19);
b2->Location = System::Drawing::Point(294,45);
b3->Location = System::Drawing::Point(294,71);
b4->Location = System::Drawing::Point(294,97);
}
if(Convert::ToDouble(textBox1->Text) == 5)
{
n = 5;
a11->Visible = true;
a12->Visible = true;
a13->Visible = true;
a14->Visible = true;
a15->Visible = true;
a21->Visible = true;
a22->Visible = true;
a23->Visible = true;
a24->Visible = true;
a25->Visible = true;
a31->Visible = true;
a32->Visible = true;
a33->Visible = true;
a34->Visible = true;
a35->Visible = true;
a41->Visible = true;
a42->Visible = true;
a43->Visible = true;
a44->Visible = true;
a45->Visible = true;
a51->Visible = true;
a52->Visible = true;
a53->Visible = true;
a54->Visible = true;
a55->Visible = true;
b1->Visible = true;
b2->Visible = true;
b3->Visible = true;
b4->Visible = true;
b5->Visible = true;
label2->Visible = true;
label3->Visible = true;
label4->Visible = true;
label5->Visible = true;
label6->Visible = true;
label6->Text = "x5 = ";
label9->Text = "x5 = ";
label9->Visible = true;
label10->Visible = true;
label11->Visible = true;
label12->Visible = true;
label13->Visible = true;
label15->Text = "x5 = ";
label15->Visible = true;
label16->Visible = true;
label17->Visible = true;
label18->Visible = true;
label19->Visible = true;
label21->Text = "x5 = ";
label21->Visible = true;
label22->Visible = true;
label23->Visible = true;
label24->Visible = true;
label25->Visible = true;
label27->Text = "x5 = ";
label27->Visible = true;
label28->Visible = true;
label29->Visible = true;
label30->Visible = true;
label31->Visible = true;
b1->Location = System::Drawing::Point(366,19);
b2->Location = System::Drawing::Point(366,45);
b3->Location = System::Drawing::Point(366,71);
b4->Location = System::Drawing::Point(366,97);
b5->Location = System::Drawing::Point(366,123);
}
if(Convert::ToDouble(textBox1->Text) == 6)
{
n = 6;
a11->Visible = true;
a12->Visible = true;
a13->Visible = true;
a14->Visible = true;
a15->Visible = true;
a16->Visible = true;
a21->Visible = true;
a22->Visible = true;
a23->Visible = true;
a24->Visible = true;
a25->Visible = true;
a26->Visible = true;
a31->Visible = true;
a32->Visible = true;
a33->Visible = true;
a34->Visible = true;
a35->Visible = true;
a36->Visible = true;
a41->Visible = true;
a42->Visible = true;
a43->Visible = true;
a44->Visible = true;
a45->Visible = true;
a46->Visible = true;
a51->Visible = true;
a52->Visible = true;
a53->Visible = true;
a54->Visible = true;
a55->Visible = true;
a56->Visible = true;
a61->Visible = true;
a62->Visible = true;
a63->Visible = true;
a64->Visible = true;
a65->Visible = true;
a66->Visible = true;
b1->Visible = true;
b2->Visible = true;
b3->Visible = true;
b4->Visible = true;
b5->Visible = true;
b6->Visible = true;
label2->Visible = true;
label3->Visible = true;
label4->Visible = true;
label5->Visible = true;
label6->Visible = true;
label7->Visible = true;
label8->Visible = true;
label9->Visible = true;
label10->Visible = true;
label11->Visible = true;
label12->Visible = true;
label13->Visible = true;
label14->Visible = true;
label15->Visible = true;
label16->Visible = true;
label17->Visible = true;
label18->Visible = true;
label19->Visible = true;
label20->Visible = true;
label21->Visible = true;
label22->Visible = true;
label23->Visible = true;
label24->Visible = true;
label25->Visible = true;
label26->Visible = true;
label27->Visible = true;
label28->Visible = true;
label29->Visible = true;
label30->Visible = true;
label31->Visible = true;
label32->Visible = true;
label33->Visible = true;
label34->Visible = true;
label35->Visible = true;
label36->Visible = true;
label37->Visible = true; }
}
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
a11->Visible = false;
a12->Visible = false;
a13->Visible = false;
a14->Visible = false;
a15->Visible = false;
a16->Visible = false;
a21->Visible = false;
a22->Visible = false;
a23->Visible = false;
a24->Visible = false;
a25->Visible = false;
a26->Visible = false;
a31->Visible = false;
a32->Visible = false;
a33->Visible = false;
a34->Visible = false;
a35->Visible = false;
a36->Visible = false;
a41->Visible = false;
a42->Visible = false;
a43->Visible = false;
a44->Visible = false;
a45->Visible = false;
a46->Visible = false;
a51->Visible = false;
a52->Visible = false;
a53->Visible = false;
a54->Visible = false;
a55->Visible = false;
a56->Visible = false;
a61->Visible = false;
a62->Visible = false;
a63->Visible = false;
a64->Visible = false;
a65->Visible = false;
a66->Visible = false;
b1->Visible = false;
b2->Visible = false;
b3->Visible = false;
b4->Visible = false;
b5->Visible = false;
b6->Visible = false;
label2->Visible = false;
label3->Visible = false;
label4->Visible = false;
label5->Visible = false;
label6->Visible = false;
label7->Visible = false;
label8->Visible = false;
label9->Visible = false;
label10->Visible = false;
label11->Visible = false;
label12->Visible = false;
label13->Visible = false;
label14->Visible = false;
label15->Visible = false;
label16->Visible = false;
label17->Visible = false;
label18->Visible = false;
label19->Visible = false;
label20->Visible = false;
label21->Visible = false;
label22->Visible = false;
label23->Visible = false;
label24->Visible = false;
label25->Visible = false;
label26->Visible = false;
label27->Visible = false;
label28->Visible = false;
label29->Visible = false;
label30->Visible = false;
label31->Visible = false;
label32->Visible = false;
label33->Visible = false;
label34->Visible = false;
label35->Visible = false;
label36->Visible = false;
label37->Visible = false;
b1->Location = System::Drawing::Point(438,19);
b2->Location = System::Drawing::Point(438,45);
b3->Location = System::Drawing::Point(438,71);
b4->Location = System::Drawing::Point(438,97);
b5->Location = System::Drawing::Point(438,123);
b6->Location = System::Drawing::Point(438,149);
label2->Text = "x1 + ";
label3->Text = "x2 + ";
label4->Text = "x3 + ";
label5->Text = "x4 + ";
label6->Text = "x5 + ";
label7->Text = "x6 = ";
label8->Text = "x6 = ";
label9->Text = "x5 + ";
label10->Text = "x4 + ";
label11->Text = "x3 + ";
label12->Text = "x2 + ";
label13->Text = "x1 + ";
label14->Text = "x6 = ";
label15->Text = "x5 + ";
label16->Text = "x4 + ";
label17->Text = "x3 + ";
label18->Text = "x2 + ";
label19->Text = "x1 + ";
label20->Text = "x6 = ";
label21->Text = "x5 + ";
label22->Text = "x4 + ";
label23->Text = "x3 + ";
label24->Text = "x2 + ";
label25->Text = "x1 + ";
label26->Text = "x6 = ";
label27->Text = "x5 + ";
label28->Text = "x4 + ";
label29->Text = "x3 + ";
label30->Text = "x2 + ";
label31->Text = "x1 + ";
label32->Text = "x6 = ";
label33->Text = "x5 + ";
label34->Text = "x4 + ";
label35->Text = "x3 + ";
label36->Text = "x2 + ";
label37->Text = "x1 + ";
}
};
}
Файл 2.cpp
// Решение систем линейных уравнений методом Гаусса с выбором главного элемента.
#include "stdafx.h"
#include "Form1.h"
using namespace My2;
[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// Включение визуальных эффектов Windows XP до создания каких-либо элементов управления
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false); // Создание главного окна и его запуск
Application::Run(gcnew Form1());
return 0;
}
Документ
Категория
Разное
Просмотров
22
Размер файла
136 Кб
Теги
практике, вычислительной
1/--страниц
Пожаловаться на содержимое документа