Форум программистов, компьютерный форум, киберфорум
C++/CLI Windows Forms
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.67/6: Рейтинг темы: голосов - 6, средняя оценка - 4.67
0 / 0 / 0
Регистрация: 04.12.2019
Сообщений: 44

Проблема с namespace

25.06.2020, 22:05. Показов 1111. Ответов 2
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
C++
1
2
3
4
5
6
7
8
namespace Labwork7 {
//...
//далее в пределах пространства имен:
//...
if (((Button^)sender)->Text != "Multiply")
    {
        LabWork7::MainForm::buttonReset(sender, e);
    }
При компиляции ошибка:LabWork7:не является именем класса или пространства имен.
И далее еще несколько ошибок, связанных с этим неопределенным пространством.

Вот весь файл:

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
#ifndef mainf
#define mainf
#include "Matrix.h"
Matrix m1(1, 1), m2(1, 1);
Matrix* pMatrix = &m1;
 
namespace Labwork7 {
 
    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::Windows::Forms::Button^ buttonAvrg;
    protected:
    private: System::Windows::Forms::Button^ buttonMin;
    protected:
    private: System::Windows::Forms::Button^ buttonMax;
    private: System::Windows::Forms::NumericUpDown^ numericUpDownRows;
    private: System::Windows::Forms::NumericUpDown^ numericUpDownColumns;
 
    private: System::Windows::Forms::Label^ labelRows;
    private: System::Windows::Forms::Label^ labelColumns;
 
    private: System::Windows::Forms::Button^ buttonReset;
    private: System::Windows::Forms::Button^ buttonInverse;
    private: System::Windows::Forms::Button^ buttonTranspose;
    private: System::Windows::Forms::Button^ buttonMultNumber;
    private: System::Windows::Forms::Button^ buttonResult;
    private: System::Windows::Forms::Button^ buttonMultiply;
    private: System::Windows::Forms::Button^ buttonSubstract;
 
    private: System::Windows::Forms::TextBox^ textBoxMain;
    private: System::Windows::Forms::Label^ labelResult;
 
    private: System::Windows::Forms::Button^ buttonPrint;
    private: System::Windows::Forms::Button^ buttonDeterminant;
    private: System::Windows::Forms::Label^ labelMain;
    private: System::Windows::Forms::DataGridView^ dataGridViewMain;
    private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column1;
    private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column2;
    private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column3;
    private: System::Windows::Forms::Button^ buttonAdd;
 
 
 
 
 
 
 
    private:
        /// <summary>
        /// Обязательная переменная конструктора.
        /// </summary>
        System::ComponentModel::Container^ components;
 
#pragma region Windows Form Designer generated code
        /// <summary>
        /// Требуемый метод для поддержки конструктора — не изменяйте 
        /// содержимое этого метода с помощью редактора кода.
        /// </summary>
        void InitializeComponent(void)
        {
            this->buttonAvrg = (gcnew System::Windows::Forms::Button());
            this->buttonMin = (gcnew System::Windows::Forms::Button());
            this->buttonMax = (gcnew System::Windows::Forms::Button());
            this->numericUpDownRows = (gcnew System::Windows::Forms::NumericUpDown());
            this->numericUpDownColumns = (gcnew System::Windows::Forms::NumericUpDown());
            this->labelRows = (gcnew System::Windows::Forms::Label());
            this->labelColumns = (gcnew System::Windows::Forms::Label());
            this->buttonReset = (gcnew System::Windows::Forms::Button());
            this->buttonInverse = (gcnew System::Windows::Forms::Button());
            this->buttonTranspose = (gcnew System::Windows::Forms::Button());
            this->buttonMultNumber = (gcnew System::Windows::Forms::Button());
            this->buttonResult = (gcnew System::Windows::Forms::Button());
            this->buttonMultiply = (gcnew System::Windows::Forms::Button());
            this->buttonSubstract = (gcnew System::Windows::Forms::Button());
            this->textBoxMain = (gcnew System::Windows::Forms::TextBox());
            this->labelResult = (gcnew System::Windows::Forms::Label());
            this->buttonPrint = (gcnew System::Windows::Forms::Button());
            this->buttonDeterminant = (gcnew System::Windows::Forms::Button());
            this->labelMain = (gcnew System::Windows::Forms::Label());
            this->dataGridViewMain = (gcnew System::Windows::Forms::DataGridView());
            this->Column1 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
            this->Column2 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
            this->Column3 = (gcnew System::Windows::Forms::DataGridViewTextBoxColumn());
            this->buttonAdd = (gcnew System::Windows::Forms::Button());
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->numericUpDownRows))->BeginInit();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->numericUpDownColumns))->BeginInit();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->dataGridViewMain))->BeginInit();
            this->SuspendLayout();
            // 
            // buttonAvrg
            // 
            this->buttonAvrg->Location = System::Drawing::Point(522, 38);
            this->buttonAvrg->Name = L"buttonAvrg";
            this->buttonAvrg->Size = System::Drawing::Size(75, 23);
            this->buttonAvrg->TabIndex = 31;
            this->buttonAvrg->Text = L"average";
            this->buttonAvrg->UseVisualStyleBackColor = true;
            // 
            // buttonMin
            // 
            this->buttonMin->Location = System::Drawing::Point(603, 9);
            this->buttonMin->Name = L"buttonMin";
            this->buttonMin->Size = System::Drawing::Size(75, 23);
            this->buttonMin->TabIndex = 30;
            this->buttonMin->Text = L"minimum";
            this->buttonMin->UseVisualStyleBackColor = true;
            // 
            // buttonMax
            // 
            this->buttonMax->Location = System::Drawing::Point(522, 9);
            this->buttonMax->Name = L"buttonMax";
            this->buttonMax->Size = System::Drawing::Size(75, 23);
            this->buttonMax->TabIndex = 29;
            this->buttonMax->Text = L"maximum\r\n";
            this->buttonMax->UseVisualStyleBackColor = true;
            // 
            // numericUpDownRows
            // 
            this->numericUpDownRows->Location = System::Drawing::Point(472, 13);
            this->numericUpDownRows->Name = L"numericUpDownRows";
            this->numericUpDownRows->Size = System::Drawing::Size(44, 20);
            this->numericUpDownRows->TabIndex = 32;
            // 
            // numericUpDownColumns
            // 
            this->numericUpDownColumns->Location = System::Drawing::Point(472, 40);
            this->numericUpDownColumns->Name = L"numericUpDownColumns";
            this->numericUpDownColumns->Size = System::Drawing::Size(44, 20);
            this->numericUpDownColumns->TabIndex = 33;
            // 
            // labelRows
            // 
            this->labelRows->AutoSize = true;
            this->labelRows->Location = System::Drawing::Point(431, 16);
            this->labelRows->Name = L"labelRows";
            this->labelRows->Size = System::Drawing::Size(29, 13);
            this->labelRows->TabIndex = 34;
            this->labelRows->Text = L"rows";
            // 
            // labelColumns
            // 
            this->labelColumns->AutoSize = true;
            this->labelColumns->Location = System::Drawing::Point(431, 42);
            this->labelColumns->Name = L"labelColumns";
            this->labelColumns->Size = System::Drawing::Size(26, 13);
            this->labelColumns->TabIndex = 35;
            this->labelColumns->Text = L"cols";
            // 
            // buttonReset
            // 
            this->buttonReset->Location = System::Drawing::Point(359, 66);
            this->buttonReset->Name = L"buttonReset";
            this->buttonReset->Size = System::Drawing::Size(157, 23);
            this->buttonReset->TabIndex = 37;
            this->buttonReset->Text = L"clear";
            this->buttonReset->UseVisualStyleBackColor = true;
            // 
            // buttonInverse
            // 
            this->buttonInverse->Location = System::Drawing::Point(603, 66);
            this->buttonInverse->Name = L"buttonInverse";
            this->buttonInverse->Size = System::Drawing::Size(75, 23);
            this->buttonInverse->TabIndex = 38;
            this->buttonInverse->Text = L"inverse";
            this->buttonInverse->UseVisualStyleBackColor = true;
            // 
            // buttonTranspose
            // 
            this->buttonTranspose->Location = System::Drawing::Point(522, 66);
            this->buttonTranspose->Name = L"buttonTranspose";
            this->buttonTranspose->Size = System::Drawing::Size(75, 23);
            this->buttonTranspose->TabIndex = 39;
            this->buttonTranspose->Text = L"transpose";
            this->buttonTranspose->UseVisualStyleBackColor = true;
            // 
            // buttonMultNumber
            // 
            this->buttonMultNumber->Location = System::Drawing::Point(603, 38);
            this->buttonMultNumber->Name = L"buttonMultNumber";
            this->buttonMultNumber->Size = System::Drawing::Size(75, 23);
            this->buttonMultNumber->TabIndex = 41;
            this->buttonMultNumber->Text = L"multiply";
            this->buttonMultNumber->UseVisualStyleBackColor = true;
            // 
            // buttonResult
            // 
            this->buttonResult->Location = System::Drawing::Point(481, 95);
            this->buttonResult->Name = L"buttonResult";
            this->buttonResult->Size = System::Drawing::Size(34, 23);
            this->buttonResult->TabIndex = 49;
            this->buttonResult->Text = L"=";
            this->buttonResult->UseVisualStyleBackColor = true;
            // 
            // buttonMultiply
            // 
            this->buttonMultiply->Location = System::Drawing::Point(441, 95);
            this->buttonMultiply->Name = L"buttonMultiply";
            this->buttonMultiply->Size = System::Drawing::Size(34, 23);
            this->buttonMultiply->TabIndex = 48;
            this->buttonMultiply->Text = L"*";
            this->buttonMultiply->UseVisualStyleBackColor = true;
            // 
            // buttonSubstract
            // 
            this->buttonSubstract->Location = System::Drawing::Point(401, 95);
            this->buttonSubstract->Name = L"buttonSubstract";
            this->buttonSubstract->Size = System::Drawing::Size(34, 23);
            this->buttonSubstract->TabIndex = 47;
            this->buttonSubstract->Text = L"-";
            this->buttonSubstract->UseVisualStyleBackColor = true;
            // 
            // textBoxMain
            // 
            this->textBoxMain->Location = System::Drawing::Point(15, 119);
            this->textBoxMain->Multiline = true;
            this->textBoxMain->Name = L"textBoxMain";
            this->textBoxMain->Size = System::Drawing::Size(311, 72);
            this->textBoxMain->TabIndex = 50;
            // 
            // labelResult
            // 
            this->labelResult->AutoSize = true;
            this->labelResult->Location = System::Drawing::Point(12, 95);
            this->labelResult->Name = L"labelResult";
            this->labelResult->Size = System::Drawing::Size(32, 13);
            this->labelResult->TabIndex = 59;
            this->labelResult->Text = L"result";
            // 
            // buttonPrint
            // 
            this->buttonPrint->Location = System::Drawing::Point(603, 95);
            this->buttonPrint->Name = L"buttonPrint";
            this->buttonPrint->Size = System::Drawing::Size(75, 23);
            this->buttonPrint->TabIndex = 60;
            this->buttonPrint->Text = L"print";
            this->buttonPrint->UseVisualStyleBackColor = true;
            // 
            // buttonDeterminant
            // 
            this->buttonDeterminant->Location = System::Drawing::Point(522, 95);
            this->buttonDeterminant->Name = L"buttonDeterminant";
            this->buttonDeterminant->Size = System::Drawing::Size(75, 23);
            this->buttonDeterminant->TabIndex = 61;
            this->buttonDeterminant->Text = L"determinant";
            this->buttonDeterminant->UseVisualStyleBackColor = true;
 
            // 
            // labelMain
            // 
            this->labelMain->Location = System::Drawing::Point(356, 122);
            this->labelMain->Name = L"labelMain";
            this->labelMain->Size = System::Drawing::Size(320, 69);
            this->labelMain->TabIndex = 63;
            this->labelMain->Text = L"label5";
            // 
            // dataGridViewMain
            // 
            this->dataGridViewMain->AutoSizeColumnsMode = System::Windows::Forms::DataGridViewAutoSizeColumnsMode::AllCells;
            this->dataGridViewMain->AutoSizeRowsMode = System::Windows::Forms::DataGridViewAutoSizeRowsMode::AllCells;
            this->dataGridViewMain->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^  >(3) {
                this->Column1,
                    this->Column2, this->Column3
            });
            this->dataGridViewMain->Location = System::Drawing::Point(12, 9);
            this->dataGridViewMain->Name = L"dataGridViewMain";
            this->dataGridViewMain->RightToLeft = System::Windows::Forms::RightToLeft::No;
            this->dataGridViewMain->RowHeadersVisible = false;
            this->dataGridViewMain->Size = System::Drawing::Size(314, 80);
            this->dataGridViewMain->TabIndex = 64;
            /*this->dataGridViewMain->CellContentClick += gcnew System::Windows::Forms::DataGridViewCellEventHandler(this, &MainForm::dataGridView1_CellContentClick);*/
            // 
            // Column1
            // 
            this->Column1->HeaderText = L"Column1";
            this->Column1->Name = L"Column1";
            this->Column1->Width = 73;
            // 
            // Column2
            // 
            this->Column2->HeaderText = L"Column2";
            this->Column2->Name = L"Column2";
            this->Column2->Width = 73;
            // 
            // Column3
            // 
            this->Column3->HeaderText = L"Column3";
            this->Column3->Name = L"Column3";
            this->Column3->Width = 73;
            // 
            // buttonAdd
            // 
            this->buttonAdd->Location = System::Drawing::Point(359, 95);
            this->buttonAdd->Name = L"buttonAdd";
            this->buttonAdd->Size = System::Drawing::Size(34, 23);
            this->buttonAdd->TabIndex = 65;
            this->buttonAdd->Text = L"+";
            this->buttonAdd->UseVisualStyleBackColor = true;
            // 
            // MainForm
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->ClientSize = System::Drawing::Size(688, 217);
            this->Controls->Add(this->buttonAdd);
            this->Controls->Add(this->dataGridViewMain);
            this->Controls->Add(this->labelMain);
            this->Controls->Add(this->buttonDeterminant);
            this->Controls->Add(this->buttonPrint);
            this->Controls->Add(this->labelResult);
            this->Controls->Add(this->textBoxMain);
            this->Controls->Add(this->buttonResult);
            this->Controls->Add(this->buttonMultiply);
            this->Controls->Add(this->buttonSubstract);
            this->Controls->Add(this->buttonMultNumber);
            this->Controls->Add(this->buttonTranspose);
            this->Controls->Add(this->buttonInverse);
            this->Controls->Add(this->buttonReset);
            this->Controls->Add(this->labelColumns);
            this->Controls->Add(this->labelRows);
            this->Controls->Add(this->numericUpDownColumns);
            this->Controls->Add(this->numericUpDownRows);
            this->Controls->Add(this->buttonAvrg);
            this->Controls->Add(this->buttonMin);
            this->Controls->Add(this->buttonMax);
            this->Name = L"MainForm";
            this->Text = L"Matrix";
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->numericUpDownRows))->EndInit();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->numericUpDownColumns))->EndInit();
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^>(this->dataGridViewMain))->EndInit();
            this->ResumeLayout(false);
            this->PerformLayout();
 
        }
#pragma endregion
 
        Button^ pButton = nullptr;
        bool bChanged = false;
 
 
 
 
    private: System::Void buttonResult_Click(System::Object^ sender, System::EventArgs^ e) {
        if (pButton == nullptr || pButton == buttonMultiply)
        {
            Button^ pTemp = pButton;
            pMatrix->MatrixSize(1, 1, false);
            pButton = buttonReset;
            numericUpDownRows->Minimum = Convert::ToDecimal(1);
            numericUpDownColumns->Minimum = Convert::ToDecimal(1);
            numericUpDownRows->Value = Convert::ToDecimal(1);
            numericUpDownColumns->Value = Convert::ToDecimal(1);
            pButton = pTemp;
        }
        else if (pButton == buttonAdd || pButton == buttonSubstract)
        {
            Button^ pTemp = pButton;
            pMatrix->MatrixSize(m1.GetRows(), m1.GetColumns(), false);
            pButton = buttonReset;
            numericUpDownRows->Minimum = Convert::ToDecimal(pMatrix->GetRows());
            numericUpDownColumns->Minimum = Convert::ToDecimal(pMatrix->GetColumns());
            numericUpDownRows->Value = Convert::ToDecimal(pMatrix->GetRows());
            numericUpDownColumns->Value = Convert::ToDecimal(pMatrix->GetColumns());
            pButton = pTemp;
        }
        DataTable^ dataTable = gcnew DataTable();
        *pMatrix >> dataTable;
        dataGridViewMain->DataSource = dataTable;
    }
 
    private: System::Void buttonValue_Click(System::Object^ sender, System::EventArgs^ e) {
        if (((Button^)sender)->Text == "Max Value")
        {
            labelMain->Text = Convert::ToString(pMatrix->MatrixMax());
        }
        else if (((Button^)sender)->Text == "Min Value")
        {
            labelMain->Text = Convert::ToString(pMatrix->MatrixMin());
        }
        else if (((Button^)sender)->Text == "Aver. Value")
        {
            labelMain->Text = Convert::ToString(pMatrix->MatrixAvrg());
        }
    }
 
    private: System::Void dataGridViewMain_CellValueChanged(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e) {
        *pMatrix << dataGridViewMain;
    }
private: System::Void buttonTranspos_Click(System::Object^ sender, System::EventArgs^ e) {
    if (pMatrix == &m1)
    {
        m1.MatrixTransposition();
        pMatrix = &m1;
    }
    else if (pMatrix == &m2)
    {
        m2.MatrixTransposition();
        pMatrix = &m2;
    }
    DataTable^ dataTable = gcnew DataTable();
    *pMatrix >> dataTable;
    dataGridViewMain->DataSource = dataTable;
    pButton = buttonReset;
    numericUpDownRows->Minimum = Convert::ToDecimal(pMatrix->GetRows());
    numericUpDownColumns->Minimum = Convert::ToDecimal(pMatrix->GetColumns());
    numericUpDownRows->Value = Convert::ToDecimal(pMatrix->GetRows());
    numericUpDownColumns->Value = Convert::ToDecimal(pMatrix->GetColumns());
    pButton = nullptr;
    labelMain->Text = "Matrix transpositioned.";
}
private: System::Void buttonInverse_Click(System::Object^ sender, System::EventArgs^ e) {
    if (pMatrix->GetRows() != pMatrix->GetColumns())
    {
        labelMain->Text = "Matrix is not square. Determinant cannot be found.";
    }
    else
    {
        Matrix mInversed(pMatrix->GetRows(), pMatrix->GetColumns());
        bool bRes = MatrixInversed(*pMatrix, mInversed);
        if (bRes == false)
        {
            labelMain->Text = "Determinant of matrix is zero. Inverse matrix cannot be found.";
        }
        else
        {
            DataTable^ dataTable = gcnew DataTable();
            mInversed >> dataTable;
            dataGridViewMain->DataSource = dataTable;
            *pMatrix = mInversed;
            labelMain->Text = "Matrix inversed.";
        }
    }
}
private: System::Void numericUpDown_ValueChanged(System::Object^ sender, System::EventArgs^ e) {
    if ((Convert::ToInt32(numericUpDownRows->Value) * Convert::ToInt32(numericUpDownColumns->Value)) >= (pMatrix->GetRows() * pMatrix->GetColumns()) && pButton != buttonReset)
    {
        if (Convert::ToUInt32(numericUpDownRows->Value) > pMatrix->GetRows())
        {
            numericUpDownRows->Minimum = Convert::ToDecimal(pMatrix->GetRows() + 1);
        }
        else if (Convert::ToUInt32(numericUpDownColumns->Value) > pMatrix->GetColumns())
        {
            numericUpDownColumns->Minimum = Convert::ToDecimal(pMatrix->GetColumns() + 1);
        }
        pMatrix->MatrixSize(Convert::ToUInt32(numericUpDownRows->Value), Convert::ToUInt32(numericUpDownColumns->Value), true);
        DataTable^ dataTable = gcnew DataTable();
        *pMatrix >> dataTable;
        dataGridViewMain->DataSource = dataTable;
    }
    else if (pButton != buttonReset)
    {
        labelMain->Text = "Enter size of an equal or bigger matrix.";
    }
}
private: System::Void buttonOperation_Click(System::Object^ sender, System::EventArgs^ e) {
    labelMain->Text = "Enter second matrix.";
    pMatrix = &m2;
    if (((Button^)sender)->Text == "+")
    {
        pButton = buttonAdd;
    }
    else if (((Button^)sender)->Text == "-")
    {
        pButton = buttonSubstract;
    }
    else if (((Button^)sender)->Text == "*")
    {
        pButton = buttonMultiply;
    }
    else if (((Button^)sender)->Text == "Multiply")
    {
        pButton = buttonMultNumber;
        labelMain->Text = "Enter your number in the text box and press =.";
        textBoxMain->Text = "";
        textBoxMain->ReadOnly = false;
    }
    if (((Button^)sender)->Text != "Multiply")
    {
        LabWork7::MainForm::buttonReset(sender, e);
    }
}
private: System::Void buttonResult_Click(System::Object^ sender, System::EventArgs^ e) {
    bool bResult = false;
    pMatrix->MatrixSize(Convert::ToUInt32(numericUpDownRows->Value), Convert::ToInt32(numericUpDownColumns->Value), false);
    *pMatrix << dataGridViewMain;
    Matrix m3(m1.GetRows(), m1.GetColumns());
    if (pButton == buttonAdd && m1.GetRows() == m2.GetRows() && m1.GetColumns() == m2.GetColumns())
    {
        m3 = m1 + m2;
        bResult = true;
    }
    else if (pButton == buttonSubstract && m1.GetRows() == m2.GetRows() && m1.GetColumns() == m2.GetColumns())
    {
        m3 = m1 - m2;
        bResult = true;
    }
    else if (pButton == buttonSubstract || pButton == buttonAdd)
    {
        labelMain->Text = "You can substract or add only equally sized matrix.";
    }
    if (pButton == buttonMultiply)
    {
        if (m1.GetColumns() == m2.GetRows())
        {
            m3.MatrixSize(m1.GetRows(), m2.GetColumns(), false);
            m3 = m1 * m2;
            bResult = true;
        }
        else
        {
            labelMain->Text = "You can multiply 2 matrix only if M1.Columns = M2.Rows.";
        }
    }
    else if (pButton == buttonMultNumber)
    {
        m3 = m1 * Convert::ToDouble(textBoxMain->Text);
        bResult = true;
        textBoxMain->Text = "";
        textBoxMain->ReadOnly = true;
    }
    pButton = nullptr;
    if (bResult == true)
    {
        DataTable^ dataTable = gcnew DataTable();
        m3 >> dataTable;
        dataGridViewMain->DataSource = dataTable;
        labelMain->Text = "Operation performed.";
        pMatrix = &m1;
    }
}
private: System::Void buttonDeterminant_Click(System::Object^ sender, System::EventArgs^ e) {
    if (pMatrix->GetRows() != pMatrix->GetColumns())
    {
        labelMain->Text = "Matrix is not square. Determinant cannot be found.";
    }
    else
    {
        labelMain->Text = Convert::ToString(pMatrix->GetDeterminant(*pMatrix, pMatrix->GetRows()));
    }
}
private: System::Void buttonPrint_Click(System::Object^ sender, System::EventArgs^ e) {
    *pMatrix << textBoxMain;
}
private: System::Void MainForm_Load(System::Object^ sender, System::EventArgs^ e) {
    DataTable^ dataTable = gcnew DataTable();
    *pMatrix >> dataTable;
    dataGridViewMain->DataSource = dataTable;
}
};
}
#endif
0
Лучшие ответы (1)
cpp_developer
Эксперт
20123 / 5690 / 1417
Регистрация: 09.04.2010
Сообщений: 22,546
Блог
25.06.2020, 22:05
Ответы с готовыми решениями:

Проблема с using namespace std;
Не работает, я как понял так нужен определенный порядок в пространстве имен. Ошибка C2065 cout: необъявленный идентификатор Помогите...

Проблема с компилятором в убунту (no member named 'default_random_engine' in namespace 'std')
Здравствуйте. поставила ubuntu 18.04 64 бит. скачала Qt Creator с оф. сайта для линукс 64, но компилятора для срр не было. попыталась...

Ошибка CS0234 The type or namespace name 'Office' does not exist in the namespace 'Microsoft'
Здравствуйте. Помогите разобраться. Сбилдил проект после переустановки винды и тут такая ошибка. Error CS0234 The type or namespace name...

2
Администратор
Эксперт .NET
 Аватар для OwenGlendower
18267 / 14190 / 5368
Регистрация: 17.03.2014
Сообщений: 28,879
Записей в блоге: 1
25.06.2020, 23:54
Лучший ответ Сообщение было отмечено Yokai0 как решение

Решение

Yokai0, 1) в C++ важен регистр. Значит Labwork7 и LabWork7 это разные идентификаторы.

2) buttonReset это переменная. Обращаться с ней как с методом бесполезно.
1
0 / 0 / 0
Регистрация: 04.12.2019
Сообщений: 44
25.06.2020, 23:58  [ТС]
Вообще не обратил вниманмя на регистр, спасибо
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
raxper
Эксперт
30234 / 6612 / 1498
Регистрация: 28.12.2010
Сообщений: 21,154
Блог
25.06.2020, 23:58
Помогаю со студенческими работами здесь

Головоломка с namespace в большом солюшине, проект подхватывает чужой namespace
Добрый вечер! Народ, подскажите, пожалуйста, что-то я никак понять не могу. Проблема в следующем: есть некое решение, в котором 50...

Области видимости namespace .Ошибка No code may exist outside of namespace {}
&lt;?php namespace MyProject{ class ClassA { public $val = 'MyProject &quot;ClassA&quot;'; } } namespace MyProject2{ class ClassA { ...

The type or namespace name 'DirectoryServices' does not exist in the namespace 'System'
Подскажите, пожалуйста! Только начинаю на C# писать!:scratch: Вот такой вроде небольшой кодик: using System; using...

Какую ссылку добавить для решения проблемы "namespace name 'Drawing' does not exist in the namespace 'System'"
уже который раз сталкиваюсь с этой проблемой. Ошибка: The type or namespace name 'Drawing' does not exist in the namespace 'System' (are...

Ошибка The type or namespace name 'MsgBox' does not exist in the class or namespace 'MsgBox.MsgBox' (are you missing an assembly reference?)
Есть Class Library, написанная на VB.NET. Компилирую, вставляю assembly в VB.NET, все работает. Вставляю в проект на C#, не работает. Делаю...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
3
Ответ Создать тему
Новые блоги и статьи
Подключение Box2D v3 к SDL3 для Android: физика и отрисовка коллайдеров
8Observer8 29.01.2026
Содержание блога Box2D - это библиотека для 2D физики для анимаций и игр. С её помощью можно определять были ли коллизии между конкретными объектами. Версия v3 была полностью переписана на Си, в. . .
Инструменты COM: Сохранение данный из VARIANT в файл и загрузка из файла в VARIANT
bedvit 28.01.2026
Сохранение базовых типов COM и массивов (одномерных или двухмерных) любой вложенности (деревья) в файл, с возможностью выбора алгоритмов сжатия и шифрования. Часть библиотеки BedvitCOM Использованы. . .
Загрузка PNG с альфа-каналом на SDL3 для Android: с помощью SDL_LoadPNG (без SDL3_image)
8Observer8 28.01.2026
Содержание блога SDL3 имеет собственные средства для загрузки и отображения PNG-файлов с альфа-каналом и базовой работы с ними. В этой инструкции используется функция SDL_LoadPNG(), которая. . .
Загрузка PNG с альфа-каналом на SDL3 для Android: с помощью SDL3_image
8Observer8 27.01.2026
Содержание блога SDL3_image - это библиотека для загрузки и работы с изображениями. Эта пошаговая инструкция покажет, как загрузить и вывести на экран смартфона картинку с альфа-каналом, то есть с. . .
Влияние грибов на сукцессию
anaschu 26.01.2026
Бифуркационные изменения массы гриба происходят тогда, когда мы уменьшаем массу компоста в 10 раз, а скорость прироста биомассы уменьшаем в три раза. Скорость прироста биомассы может уменьшаться за. . .
Воспроизведение звукового файла с помощью SDL3_mixer при касании экрана Android
8Observer8 26.01.2026
Содержание блога SDL3_mixer - это библиотека я для воспроизведения аудио. В отличие от инструкции по добавлению текста код по проигрыванию звука уже содержится в шаблоне примера. Нужно только. . .
Установка Android SDK, NDK, JDK, CMake и т.д.
8Observer8 25.01.2026
Содержание блога Перейдите по ссылке: https:/ / developer. android. com/ studio и в самом низу страницы кликните по архиву "commandlinetools-win-xxxxxx_latest. zip" Извлеките архив и вы увидите. . .
Вывод текста со шрифтом TTF на Android с помощью библиотеки SDL3_ttf
8Observer8 25.01.2026
Содержание блога Если у вас не установлены Android SDK, NDK, JDK, и т. д. то сделайте это по следующей инструкции: Установка Android SDK, NDK, JDK, CMake и т. д. Сборка примера Скачайте. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru