Download - APLICACION DE MATRICES EN VISUAL C++

Transcript
Page 1: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 1

CURSO: ESTRUCTURA DE INFORMACION

DOCENTE: TORALVA GONZALES PAUL

FACULTAD: INGENIERIA DE SISTEMA CÓMPUTO Y

TELECOMUNICACIONES

INTEGRANTES: JUNIOR ALEJANDRO HURTADO AVALOS

CICLO: IV TURNO: NOCTURNO

2012

Page 2: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 2

EJERCICIOS DESARROLLADOS DE LA PRACTICA N°4

Page 3: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 3

1)

#pragma once

namespace MATRICEZ01 {

using namespace System;

using namespace System::ComponentModel;

using namespace System::Collections;

using namespace System::Windows::Forms;

using namespace System::Data;

using namespace System::Drawing;

int f=0,c=0;

int matriz[4][4];

int cont=0;

double auxi=0,auxi2=0,auxi3=0,auxi4=0;

/// <summary>

/// Resumen de Form1

///

/// ADVERTENCIA: si cambia el nombre de esta clase, deberá

cambiar la

/// propiedad 'Nombre de archivos de recursos' de la

herramienta de compilación de recursos administrados

/// asociada con todos los archivos .resx de los que

depende esta clase. De lo contrario,

/// los diseñadores no podrán interactuar correctamente

con los

/// recursos adaptados asociados con este formulario.

/// </summary>

public ref class Form1 : public System::Windows::Forms::Form

{

public:

Form1(void)

{

InitializeComponent();

//

//TODO: agregar código de constructor aquí

//

}

protected:

/// <summary>

/// Limpiar los recursos que se estén utilizando.

/// </summary>

~Form1()

{

if (components)

{

delete components;

}

}

private: System::Windows::Forms::Label^ label1;

protected:

private: System::Windows::Forms::Label^ label2;

private: System::Windows::Forms::Label^ label3;

private: System::Windows::Forms::Button^ button1;

private: System::Windows::Forms::Button^ button2;

private: System::Windows::Forms::Label^ label4;

private: System::Windows::Forms::Label^ label5;

private: System::Windows::Forms::ListBox^ listBox1;

private: System::Windows::Forms::Button^ button3;

Page 4: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 4

private: System::Windows::Forms::Button^ button4;

private: System::Windows::Forms::Label^ label6;

private: System::Windows::Forms::Label^ label7;

private: System::Windows::Forms::Label^ label8;

private: System::Windows::Forms::Label^ label9;

private: System::Windows::Forms::Label^ label10;

private: System::Windows::Forms::Label^ label11;

private: System::Windows::Forms::Label^ label12;

private: System::Windows::Forms::Label^ label13;

private: System::Windows::Forms::TextBox^ textBox1;

private:

/// <summary>

/// Variable del diseñador requerida.

/// </summary>

System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code

/// <summary>

/// Método necesario para admitir el Diseñador. No se puede

modificar

/// el contenido del método con el editor de código.

/// </summary>

void InitializeComponent(void)

{

this->label1 = (gcnew

System::Windows::Forms::Label());

this->label2 = (gcnew

System::Windows::Forms::Label());

this->label3 = (gcnew

System::Windows::Forms::Label());

this->button1 = (gcnew

System::Windows::Forms::Button());

this->button2 = (gcnew

System::Windows::Forms::Button());

this->label4 = (gcnew

System::Windows::Forms::Label());

this->label5 = (gcnew

System::Windows::Forms::Label());

this->listBox1 = (gcnew

System::Windows::Forms::ListBox());

this->button3 = (gcnew

System::Windows::Forms::Button());

this->button4 = (gcnew

System::Windows::Forms::Button());

this->label6 = (gcnew

System::Windows::Forms::Label());

this->label7 = (gcnew

System::Windows::Forms::Label());

this->label8 = (gcnew

System::Windows::Forms::Label());

this->label9 = (gcnew

System::Windows::Forms::Label());

this->label10 = (gcnew

System::Windows::Forms::Label());

this->label11 = (gcnew

System::Windows::Forms::Label());

this->label12 = (gcnew

System::Windows::Forms::Label());

this->label13 = (gcnew

System::Windows::Forms::Label());

Page 5: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 5

this->textBox1 = (gcnew

System::Windows::Forms::TextBox());

this->SuspendLayout();

//

// label1

//

this->label1->AutoSize = true;

this->label1->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 12,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label1->Location = System::Drawing::Point(141,

28);

this->label1->Name = L"label1";

this->label1->Size = System::Drawing::Size(112, 20);

this->label1->TabIndex = 0;

this->label1->Text = L"MATRIZ 4X4";

//

// label2

//

this->label2->AutoSize = true;

this->label2->Location = System::Drawing::Point(39,

83);

this->label2->Name = L"label2";

this->label2->Size = System::Drawing::Size(29, 13);

this->label2->TabIndex = 1;

this->label2->Text = L"FILA";

//

// label3

//

this->label3->AutoSize = true;

this->label3->Location = System::Drawing::Point(39,

126);

this->label3->Name = L"label3";

this->label3->Size = System::Drawing::Size(60, 13);

this->label3->TabIndex = 2;

this->label3->Text = L"COLUMNA";

//

// button1

//

this->button1->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->button1->Location = System::Drawing::Point(250,

83);

this->button1->Name = L"button1";

this->button1->Size = System::Drawing::Size(117, 40);

this->button1->TabIndex = 3;

this->button1->Text = L"INGRESAR";

this->button1->UseVisualStyleBackColor = true;

this->button1->Click += gcnew

System::EventHandler(this, &Form1::button1_Click);

//

// button2

//

this->button2->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

Page 6: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 6

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->button2->Location = System::Drawing::Point(42,

162);

this->button2->Name = L"button2";

this->button2->Size = System::Drawing::Size(342, 43);

this->button2->TabIndex = 4;

this->button2->Text = L"MOSTRAR";

this->button2->UseVisualStyleBackColor = true;

this->button2->Click += gcnew

System::EventHandler(this, &Form1::button2_Click);

//

// label4

//

this->label4->AutoSize = true;

this->label4->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 9.75F,

System::Drawing::FontStyle::Regular,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label4->Location = System::Drawing::Point(170,

223);

this->label4->Name = L"label4";

this->label4->Size = System::Drawing::Size(83, 16);

this->label4->TabIndex = 5;

this->label4->Text = L"COLUMNAS";

//

// label5

//

this->label5->AutoSize = true;

this->label5->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 9.75F,

System::Drawing::FontStyle::Regular,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label5->Location = System::Drawing::Point(74,

312);

this->label5->Name = L"label5";

this->label5->Size = System::Drawing::Size(44, 16);

this->label5->TabIndex = 6;

this->label5->Text = L"FILAS";

//

// listBox1

//

this->listBox1->FormattingEnabled = true;

this->listBox1->Location =

System::Drawing::Point(145, 267);

this->listBox1->Name = L"listBox1";

this->listBox1->Size = System::Drawing::Size(171,

108);

this->listBox1->TabIndex = 7;

//

// button3

//

this->button3->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

Page 7: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 7

this->button3->Location = System::Drawing::Point(85,

411);

this->button3->Name = L"button3";

this->button3->Size = System::Drawing::Size(102, 48);

this->button3->TabIndex = 8;

this->button3->Text = L"NUEVO";

this->button3->UseVisualStyleBackColor = true;

this->button3->Click += gcnew

System::EventHandler(this, &Form1::button3_Click);

//

// button4

//

this->button4->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->button4->Location = System::Drawing::Point(241,

411);

this->button4->Name = L"button4";

this->button4->Size = System::Drawing::Size(99, 48);

this->button4->TabIndex = 9;

this->button4->Text = L"SALIR";

this->button4->UseVisualStyleBackColor = true;

this->button4->Click += gcnew

System::EventHandler(this, &Form1::button4_Click);

//

// label6

//

this->label6->AutoSize = true;

this->label6->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 9.75F,

System::Drawing::FontStyle::Regular,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label6->Location = System::Drawing::Point(152,

248);

this->label6->Name = L"label6";

this->label6->Size = System::Drawing::Size(15, 16);

this->label6->TabIndex = 10;

this->label6->Text = L"1";

//

// label7

//

this->label7->AutoSize = true;

this->label7->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 9.75F,

System::Drawing::FontStyle::Regular,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label7->Location = System::Drawing::Point(195,

248);

this->label7->Name = L"label7";

this->label7->Size = System::Drawing::Size(15, 16);

this->label7->TabIndex = 11;

this->label7->Text = L"2";

//

// label8

//

this->label8->AutoSize = true;

Page 8: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 8

this->label8->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 9.75F,

System::Drawing::FontStyle::Regular,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label8->Location = System::Drawing::Point(238,

248);

this->label8->Name = L"label8";

this->label8->Size = System::Drawing::Size(15, 16);

this->label8->TabIndex = 12;

this->label8->Text = L"3";

//

// label9

//

this->label9->AutoSize = true;

this->label9->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 9.75F,

System::Drawing::FontStyle::Regular,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label9->Location = System::Drawing::Point(287,

248);

this->label9->Name = L"label9";

this->label9->Size = System::Drawing::Size(15, 16);

this->label9->TabIndex = 13;

this->label9->Text = L"4";

//

// label10

//

this->label10->AutoSize = true;

this->label10->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 9.75F,

System::Drawing::FontStyle::Regular,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label10->Location = System::Drawing::Point(124,

267);

this->label10->Name = L"label10";

this->label10->Size = System::Drawing::Size(15, 16);

this->label10->TabIndex = 14;

this->label10->Text = L"1";

//

// label11

//

this->label11->AutoSize = true;

this->label11->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 9.75F,

System::Drawing::FontStyle::Regular,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label11->Location = System::Drawing::Point(124,

295);

this->label11->Name = L"label11";

this->label11->Size = System::Drawing::Size(15, 16);

this->label11->TabIndex = 15;

this->label11->Text = L"2";

//

// label12

//

this->label12->AutoSize = true;

Page 9: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 9

this->label12->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 9.75F,

System::Drawing::FontStyle::Regular,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label12->Location = System::Drawing::Point(124,

323);

this->label12->Name = L"label12";

this->label12->Size = System::Drawing::Size(15, 16);

this->label12->TabIndex = 16;

this->label12->Text = L"3";

//

// label13

//

this->label13->AutoSize = true;

this->label13->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 9.75F,

System::Drawing::FontStyle::Regular,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label13->Location = System::Drawing::Point(124,

348);

this->label13->Name = L"label13";

this->label13->Size = System::Drawing::Size(15, 16);

this->label13->TabIndex = 17;

this->label13->Text = L"4";

//

// textBox1

//

this->textBox1->Location = System::Drawing::Point(88,

83);

this->textBox1->Name = L"textBox1";

this->textBox1->Size = System::Drawing::Size(141,

20);

this->textBox1->TabIndex = 18;

//

// Form1

//

this->AutoScaleDimensions = System::Drawing::SizeF(6,

13);

this->AutoScaleMode =

System::Windows::Forms::AutoScaleMode::Font;

this->ClientSize = System::Drawing::Size(430, 516);

this->Controls->Add(this->textBox1);

this->Controls->Add(this->label13);

this->Controls->Add(this->label12);

this->Controls->Add(this->label11);

this->Controls->Add(this->label10);

this->Controls->Add(this->label9);

this->Controls->Add(this->label8);

this->Controls->Add(this->label7);

this->Controls->Add(this->label6);

this->Controls->Add(this->button4);

this->Controls->Add(this->button3);

this->Controls->Add(this->listBox1);

this->Controls->Add(this->label5);

this->Controls->Add(this->label4);

this->Controls->Add(this->button2);

this->Controls->Add(this->button1);

this->Controls->Add(this->label3);

this->Controls->Add(this->label2);

Page 10: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 10

this->Controls->Add(this->label1);

this->Name = L"Form1";

this->Text = L"Form1";

this->ResumeLayout(false);

this->PerformLayout();

}

#pragma endregion

private: System::Void button1_Click(System::Object^ sender,

System::EventArgs^ e) {

matriz[f][c]=Convert::ToInt32(textBox1->Text);

cont++;

if(f==0){

auxi=auxi+matriz[f][c];

}

if(f==1){

auxi2=auxi2+matriz[f][c];

}

if(f==2){

auxi3=auxi3+matriz[f][c];

}

if(f==3){

auxi4=auxi4+matriz[f][c]; }

f++;

if(f==4){

c++;

f=0;

}

if(cont==16){

button1->Enabled=false;

}

textBox1->Text="";

textBox1->Focus();

}

private: System::Void button2_Click(System::Object^ sender,

System::EventArgs^ e) {

int c=0,f=0;

for (int f=0;f<4;f++){

listBox1->Items-

>Add(matriz[f][c]+"\t"+matriz[f][c+1]+"\t"+matriz[f][c+2]+"\t"+matriz[

f][c+3]);

listBox1->Items->Add("\n");

}

}

private: System::Void button3_Click(System::Object^ sender,

System::EventArgs^ e) {

listBox1->Items->Clear();

button1->Enabled=true;

f=0;

c=0;

cont=0;

auxi=0;

auxi2=0;

auxi3=0;

auxi4=0;

}

private: System::Void button4_Click(System::Object^ sender,

System::EventArgs^ e) {

Application::Exit();

}

};

}

Page 11: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 11

2)

#pragma once

namespace MATRICEZ01 {

using namespace System;

using namespace System::ComponentModel;

using namespace System::Collections;

using namespace System::Windows::Forms;

using namespace System::Data;

using namespace System::Drawing;

int f=0,c=0;

int matriz[3][3];

int cont=0;

double auxi=0,auxi2=0,auxi3=0;

/// <summary>

/// Resumen de Form1

///

/// ADVERTENCIA: si cambia el nombre de esta clase, deberá

cambiar la

/// propiedad 'Nombre de archivos de recursos' de la

herramienta de compilación de recursos administrados

/// asociada con todos los archivos .resx de los que

depende esta clase. De lo contrario,

Page 12: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 12

/// los diseñadores no podrán interactuar correctamente

con los

/// recursos adaptados asociados con este formulario.

/// </summary>

public ref class Form1 : public System::Windows::Forms::Form

{

public:

Form1(void)

{

InitializeComponent();

//

//TODO: agregar código de constructor aquí

//

}

protected:

/// <summary>

/// Limpiar los recursos que se estén utilizando.

/// </summary>

~Form1()

{

if (components)

{

delete components;

}

}

private: System::Windows::Forms::Label^ label1;

private: System::Windows::Forms::Label^ label2;

private: System::Windows::Forms::Label^ label3;

private: System::Windows::Forms::Button^ button1;

private: System::Windows::Forms::Button^ button2;

private: System::Windows::Forms::ListBox^ listBox1;

private: System::Windows::Forms::Button^ button3;

private: System::Windows::Forms::Label^ label4;

private: System::Windows::Forms::Label^ label5;

private: System::Windows::Forms::Label^ label6;

private: System::Windows::Forms::Label^ label7;

private: System::Windows::Forms::Label^ label8;

private: System::Windows::Forms::Label^ label9;

private: System::Windows::Forms::Button^ button4;

private: System::Windows::Forms::Button^ button5;

private: System::Windows::Forms::TextBox^ textBox1;

private: System::Windows::Forms::TextBox^ textBox2;

private: System::Windows::Forms::TextBox^ textBox3;

private: System::Windows::Forms::TextBox^ textBox4;

protected:

protected:

private:

/// <summary>

/// Variable del diseñador requerida.

/// </summary>

System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code

/// <summary>

/// Método necesario para admitir el Diseñador. No se puede

modificar

Page 13: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 13

/// el contenido del método con el editor de código.

/// </summary>

void InitializeComponent(void)

{

this->label1 = (gcnew

System::Windows::Forms::Label());

this->label2 = (gcnew

System::Windows::Forms::Label());

this->label3 = (gcnew

System::Windows::Forms::Label());

this->button1 = (gcnew

System::Windows::Forms::Button());

this->button2 = (gcnew

System::Windows::Forms::Button());

this->listBox1 = (gcnew

System::Windows::Forms::ListBox());

this->button3 = (gcnew

System::Windows::Forms::Button());

this->label4 = (gcnew

System::Windows::Forms::Label());

this->label5 = (gcnew

System::Windows::Forms::Label());

this->label6 = (gcnew

System::Windows::Forms::Label());

this->label7 = (gcnew

System::Windows::Forms::Label());

this->label8 = (gcnew

System::Windows::Forms::Label());

this->label9 = (gcnew

System::Windows::Forms::Label());

this->button4 = (gcnew

System::Windows::Forms::Button());

this->button5 = (gcnew

System::Windows::Forms::Button());

this->textBox1 = (gcnew

System::Windows::Forms::TextBox());

this->textBox2 = (gcnew

System::Windows::Forms::TextBox());

this->textBox3 = (gcnew

System::Windows::Forms::TextBox());

this->textBox4 = (gcnew

System::Windows::Forms::TextBox());

this->SuspendLayout();

//

// label1

//

this->label1->AutoSize = true;

this->label1->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 12,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label1->Location = System::Drawing::Point(132,

25);

this->label1->Name = L"label1";

this->label1->Size = System::Drawing::Size(208, 20);

this->label1->TabIndex = 0;

this->label1->Text = L"PROMEDIO DE UNIDAD";

//

// label2

//

Page 14: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 14

this->label2->AutoSize = true;

this->label2->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 9.75F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label2->Location = System::Drawing::Point(46,

85);

this->label2->Name = L"label2";

this->label2->Size = System::Drawing::Size(39, 16);

this->label2->TabIndex = 1;

this->label2->Text = L"FILA";

//

// label3

//

this->label3->AutoSize = true;

this->label3->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 9.75F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label3->Location = System::Drawing::Point(46,

127);

this->label3->Name = L"label3";

this->label3->Size = System::Drawing::Size(89, 16);

this->label3->TabIndex = 2;

this->label3->Text = L"CLOLUMNA";

//

// button1

//

this->button1->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->button1->Location = System::Drawing::Point(309,

85);

this->button1->Name = L"button1";

this->button1->Size = System::Drawing::Size(131, 46);

this->button1->TabIndex = 3;

this->button1->Text = L"INGRESAR";

this->button1->UseVisualStyleBackColor = true;

this->button1->Click += gcnew

System::EventHandler(this, &Form1::button1_Click);

//

// button2

//

this->button2->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->button2->Location = System::Drawing::Point(49,

165);

this->button2->Name = L"button2";

this->button2->Size = System::Drawing::Size(360, 47);

this->button2->TabIndex = 4;

this->button2->Text = L"MOSTRAR";

this->button2->UseVisualStyleBackColor = true;

this->button2->Click += gcnew

System::EventHandler(this, &Form1::button2_Click);

Page 15: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 15

//

// listBox1

//

this->listBox1->FormattingEnabled = true;

this->listBox1->Location =

System::Drawing::Point(125, 303);

this->listBox1->Name = L"listBox1";

this->listBox1->Size = System::Drawing::Size(149,

108);

this->listBox1->TabIndex = 5;

//

// button3

//

this->button3->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->button3->Location = System::Drawing::Point(309,

234);

this->button3->Name = L"button3";

this->button3->Size = System::Drawing::Size(105, 38);

this->button3->TabIndex = 6;

this->button3->Text = L"PROMEDIO";

this->button3->UseVisualStyleBackColor = true;

this->button3->Click += gcnew

System::EventHandler(this, &Form1::button3_Click);

//

// label4

//

this->label4->AutoSize = true;

this->label4->Location = System::Drawing::Point(133,

271);

this->label4->Name = L"label4";

this->label4->Size = System::Drawing::Size(38, 13);

this->label4->TabIndex = 10;

this->label4->Text = L"1 Unid";

//

// label5

//

this->label5->AutoSize = true;

this->label5->Location = System::Drawing::Point(174,

271);

this->label5->Name = L"label5";

this->label5->Size = System::Drawing::Size(38, 13);

this->label5->TabIndex = 11;

this->label5->Text = L"2 Unid";

//

// label6

//

this->label6->AutoSize = true;

this->label6->Location = System::Drawing::Point(215,

271);

this->label6->Name = L"label6";

this->label6->Size = System::Drawing::Size(38, 13);

this->label6->TabIndex = 12;

this->label6->Text = L"3 Unid";

//

// label7

//

this->label7->AutoSize = true;

Page 16: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 16

this->label7->Location = System::Drawing::Point(42,

317);

this->label7->Name = L"label7";

this->label7->Size = System::Drawing::Size(77, 13);

this->label7->TabIndex = 13;

this->label7->Text = L"LUIS YATACO";

//

// label8

//

this->label8->AutoSize = true;

this->label8->Location = System::Drawing::Point(17,

352);

this->label8->Name = L"label8";

this->label8->Size = System::Drawing::Size(102, 13);

this->label8->TabIndex = 14;

this->label8->Text = L"MARCOS SARAVIA";

//

// label9

//

this->label9->AutoSize = true;

this->label9->Location = System::Drawing::Point(27,

391);

this->label9->Name = L"label9";

this->label9->Size = System::Drawing::Size(92, 13);

this->label9->TabIndex = 15;

this->label9->Text = L"MARIA ROMERO";

//

// button4

//

this->button4->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->button4->Location = System::Drawing::Point(100,

431);

this->button4->Name = L"button4";

this->button4->Size = System::Drawing::Size(109, 49);

this->button4->TabIndex = 16;

this->button4->Text = L"NUEVO";

this->button4->UseVisualStyleBackColor = true;

this->button4->Click += gcnew

System::EventHandler(this, &Form1::button4_Click);

//

// button5

//

this->button5->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->button5->Location = System::Drawing::Point(279,

431);

this->button5->Name = L"button5";

this->button5->Size = System::Drawing::Size(109, 49);

this->button5->TabIndex = 17;

this->button5->Text = L"SALIR";

this->button5->UseVisualStyleBackColor = true;

this->button5->Click += gcnew

System::EventHandler(this, &Form1::button5_Click);

//

Page 17: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 17

// textBox1

//

this->textBox1->Location =

System::Drawing::Point(136, 85);

this->textBox1->Name = L"textBox1";

this->textBox1->Size = System::Drawing::Size(144,

20);

this->textBox1->TabIndex = 18;

//

// textBox2

//

this->textBox2->Location =

System::Drawing::Point(314, 310);

this->textBox2->Name = L"textBox2";

this->textBox2->Size = System::Drawing::Size(100,

20);

this->textBox2->TabIndex = 19;

//

// textBox3

//

this->textBox3->Location =

System::Drawing::Point(314, 349);

this->textBox3->Name = L"textBox3";

this->textBox3->Size = System::Drawing::Size(100,

20);

this->textBox3->TabIndex = 20;

//

// textBox4

//

this->textBox4->Location =

System::Drawing::Point(314, 391);

this->textBox4->Name = L"textBox4";

this->textBox4->Size = System::Drawing::Size(100,

20);

this->textBox4->TabIndex = 21;

//

// Form1

//

this->AutoScaleDimensions = System::Drawing::SizeF(6,

13);

this->AutoScaleMode =

System::Windows::Forms::AutoScaleMode::Font;

this->ClientSize = System::Drawing::Size(487, 516);

this->Controls->Add(this->textBox4);

this->Controls->Add(this->textBox3);

this->Controls->Add(this->textBox2);

this->Controls->Add(this->textBox1);

this->Controls->Add(this->button5);

this->Controls->Add(this->button4);

this->Controls->Add(this->label9);

this->Controls->Add(this->label8);

this->Controls->Add(this->label7);

this->Controls->Add(this->label6);

this->Controls->Add(this->label5);

this->Controls->Add(this->label4);

this->Controls->Add(this->button3);

this->Controls->Add(this->listBox1);

this->Controls->Add(this->button2);

this->Controls->Add(this->button1);

this->Controls->Add(this->label3);

this->Controls->Add(this->label2);

Page 18: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 18

this->Controls->Add(this->label1);

this->Name = L"Form1";

this->Text = L"Form1";

this->ResumeLayout(false);

this->PerformLayout();

}

private: System::Void button1_Click(System::Object^ sender,

System::EventArgs^ e) {

matriz[f][c]=Convert::ToInt32(textBox1->Text);

cont++;

if(f==0){

auxi=auxi+matriz[f][c];

}

if(f==1){

auxi2=auxi2+matriz[f][c];

}

if(f==2){

auxi3=auxi3+matriz[f][c];

}

f++;

if(f==3){

c++;

f=0;

}

if(cont==9){

button1->Enabled=false;

}

textBox1->Text="";

textBox1->Focus();

}

private: System::Void button2_Click(System::Object^ sender,

System::EventArgs^ e) {

int c=0,f=0;

for (int f=0;f<3;f++){

listBox1->Items-

>Add(matriz[f][c]+"\t"+matriz[f][c+1]+"\t"+matriz[f][c+2]);

listBox1->Items->Add("\n");

}

}

private: System::Void button3_Click(System::Object^ sender,

System::EventArgs^ e) {

textBox2->Text=String::Format("{0:F2}",auxi/3);

textBox3->Text=String::Format("{0:F2}",auxi2/3);

textBox4->Text=String::Format("{0:F2}",auxi3/3);

}

private: System::Void button4_Click(System::Object^ sender,

System::EventArgs^ e) {

textBox2->Text="";

textBox3->Text="";

textBox4->Text="";

listBox1->Items->Clear();

button1->Enabled=true;

f=0;

c=0;

cont=0;

auxi=0;

auxi2=0;

auxi3=0;

Page 19: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 19

}

private: System::Void button5_Click(System::Object^ sender,

System::EventArgs^ e) {

Application::Exit();

}

};

}

3)

#pragma once

namespace MATRICEZ01 {

using namespace System;

using namespace System::ComponentModel;

using namespace System::Collections;

using namespace System::Windows::Forms;

using namespace System::Data;

using namespace System::Drawing;

int f=0,c=0,l=0,j=0;;

int matriz[3][3];

int cont=0;

double auxi=0,auxi2=0,auxi3=0;

/// <summary>

/// Resumen de Form1

///

Page 20: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 20

/// ADVERTENCIA: si cambia el nombre de esta clase, deberá

cambiar la

/// propiedad 'Nombre de archivos de recursos' de la

herramienta de compilación de recursos administrados

/// asociada con todos los archivos .resx de los que

depende esta clase. De lo contrario,

/// los diseñadores no podrán interactuar correctamente

con los

/// recursos adaptados asociados con este formulario.

/// </summary>

public ref class Form1 : public System::Windows::Forms::Form

{

public:

Form1(void)

{

InitializeComponent();

//

//TODO: agregar código de constructor aquí

//

}

protected:

/// <summary>

/// Limpiar los recursos que se estén utilizando.

/// </summary>

~Form1()

{

if (components)

{

delete components;

}

}

private: System::Windows::Forms::Label^ label1;

protected:

private: System::Windows::Forms::Label^ label2;

private: System::Windows::Forms::Label^ label3;

private: System::Windows::Forms::Label^ label4;

private: System::Windows::Forms::Label^ label5;

private: System::Windows::Forms::Label^ label6;

private: System::Windows::Forms::Label^ label7;

private: System::Windows::Forms::Label^ label8;

private: System::Windows::Forms::ListBox^ listBox1;

private: System::Windows::Forms::TextBox^ textBox1;

private: System::Windows::Forms::Button^ button1;

private: System::Windows::Forms::Button^ button2;

private: System::Windows::Forms::Button^ button3;

private: System::Windows::Forms::Label^ label9;

private: System::Windows::Forms::Label^ label10;

private: System::Windows::Forms::Label^ label11;

private: System::Windows::Forms::TextBox^ textBox2;

private: System::Windows::Forms::TextBox^ textBox3;

private: System::Windows::Forms::TextBox^ textBox4;

private: System::Windows::Forms::Label^ label12;

private: System::Windows::Forms::TextBox^ textBox5;

private: System::Windows::Forms::Label^ label13;

private: System::Windows::Forms::TextBox^ textBox6;

private: System::Windows::Forms::Button^ button4;

private: System::Windows::Forms::Button^ button5;

protected:

Page 21: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 21

protected:

private:

/// <summary>

/// Variable del diseñador requerida.

/// </summary>

System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code

/// <summary>

/// Método necesario para admitir el Diseñador. No se puede

modificar

/// el contenido del método con el editor de código.

/// </summary>

void InitializeComponent(void)

{

this->label1 = (gcnew

System::Windows::Forms::Label());

this->label2 = (gcnew

System::Windows::Forms::Label());

this->label3 = (gcnew

System::Windows::Forms::Label());

this->label4 = (gcnew

System::Windows::Forms::Label());

this->label5 = (gcnew

System::Windows::Forms::Label());

this->label6 = (gcnew

System::Windows::Forms::Label());

this->label7 = (gcnew

System::Windows::Forms::Label());

this->label8 = (gcnew

System::Windows::Forms::Label());

this->listBox1 = (gcnew

System::Windows::Forms::ListBox());

this->textBox1 = (gcnew

System::Windows::Forms::TextBox());

this->button1 = (gcnew

System::Windows::Forms::Button());

this->button2 = (gcnew

System::Windows::Forms::Button());

this->button3 = (gcnew

System::Windows::Forms::Button());

this->label9 = (gcnew

System::Windows::Forms::Label());

this->label10 = (gcnew

System::Windows::Forms::Label());

this->label11 = (gcnew

System::Windows::Forms::Label());

this->textBox2 = (gcnew

System::Windows::Forms::TextBox());

this->textBox3 = (gcnew

System::Windows::Forms::TextBox());

this->textBox4 = (gcnew

System::Windows::Forms::TextBox());

this->label12 = (gcnew

System::Windows::Forms::Label());

this->textBox5 = (gcnew

System::Windows::Forms::TextBox());

this->label13 = (gcnew

System::Windows::Forms::Label());

this->textBox6 = (gcnew

System::Windows::Forms::TextBox());

Page 22: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 22

this->button4 = (gcnew

System::Windows::Forms::Button());

this->button5 = (gcnew

System::Windows::Forms::Button());

this->SuspendLayout();

//

// label1

//

this->label1->AutoSize = true;

this->label1->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 12,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label1->Location = System::Drawing::Point(77,

40);

this->label1->Name = L"label1";

this->label1->Size = System::Drawing::Size(310, 20);

this->label1->TabIndex = 0;

this->label1->Text = L"ORBIS-TELECOMUNICACIONES S.A";

//

// label2

//

this->label2->AutoSize = true;

this->label2->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 9.75F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label2->Location = System::Drawing::Point(129,

75);

this->label2->Name = L"label2";

this->label2->Size = System::Drawing::Size(211, 16);

this->label2->TabIndex = 1;

this->label2->Text = L"VENTAS- I TRIMESTRE-2009";

//

// label3

//

this->label3->AutoSize = true;

this->label3->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label3->Location = System::Drawing::Point(126,

153);

this->label3->Name = L"label3";

this->label3->Size = System::Drawing::Size(50, 13);

this->label3->TabIndex = 2;

this->label3->Text = L"ENERO";

//

// label4

//

this->label4->AutoSize = true;

this->label4->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label4->Location = System::Drawing::Point(182,

153);

Page 23: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 23

this->label4->Name = L"label4";

this->label4->Size = System::Drawing::Size(65, 13);

this->label4->TabIndex = 3;

this->label4->Text = L"FEBRERO";

//

// label5

//

this->label5->AutoSize = true;

this->label5->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label5->Location = System::Drawing::Point(253,

153);

this->label5->Name = L"label5";

this->label5->Size = System::Drawing::Size(51, 13);

this->label5->TabIndex = 4;

this->label5->Text = L"MARZO";

//

// label6

//

this->label6->AutoSize = true;

this->label6->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label6->Location = System::Drawing::Point(51,

179);

this->label6->Name = L"label6";

this->label6->Size = System::Drawing::Size(72, 13);

this->label6->TabIndex = 5;

this->label6->Text = L"TECLADOS";

//

// label7

//

this->label7->AutoSize = true;

this->label7->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label7->Location = System::Drawing::Point(72,

206);

this->label7->Name = L"label7";

this->label7->Size = System::Drawing::Size(51, 13);

this->label7->TabIndex = 6;

this->label7->Text = L"MOUSE";

//

// label8

//

this->label8->AutoSize = true;

this->label8->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label8->Location = System::Drawing::Point(58,

231);

this->label8->Name = L"label8";

Page 24: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 24

this->label8->Size = System::Drawing::Size(65, 13);

this->label8->TabIndex = 7;

this->label8->Text = L"MONITOR";

//

// listBox1

//

this->listBox1->FormattingEnabled = true;

this->listBox1->Location =

System::Drawing::Point(129, 179);

this->listBox1->Name = L"listBox1";

this->listBox1->Size = System::Drawing::Size(175,

82);

this->listBox1->TabIndex = 8;

//

// textBox1

//

this->textBox1->Location =

System::Drawing::Point(129, 113);

this->textBox1->Name = L"textBox1";

this->textBox1->Size = System::Drawing::Size(228,

20);

this->textBox1->TabIndex = 9;

//

// button1

//

this->button1->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->button1->Location = System::Drawing::Point(375,

113);

this->button1->Name = L"button1";

this->button1->Size = System::Drawing::Size(100, 30);

this->button1->TabIndex = 10;

this->button1->Text = L"INGRESAR";

this->button1->UseVisualStyleBackColor = true;

this->button1->Click += gcnew

System::EventHandler(this, &Form1::button1_Click);

//

// button2

//

this->button2->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->button2->Location = System::Drawing::Point(375,

215);

this->button2->Name = L"button2";

this->button2->Size = System::Drawing::Size(100, 29);

this->button2->TabIndex = 11;

this->button2->Text = L"NUEVO";

this->button2->UseVisualStyleBackColor = true;

this->button2->Click += gcnew

System::EventHandler(this, &Form1::button2_Click);

//

// button3

//

this->button3->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

Page 25: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 25

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->button3->Location = System::Drawing::Point(375,

250);

this->button3->Name = L"button3";

this->button3->Size = System::Drawing::Size(100, 28);

this->button3->TabIndex = 12;

this->button3->Text = L"SALIR";

this->button3->UseVisualStyleBackColor = true;

this->button3->Click += gcnew

System::EventHandler(this, &Form1::button3_Click);

//

// label9

//

this->label9->AutoSize = true;

this->label9->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label9->Location = System::Drawing::Point(33,

330);

this->label9->Name = L"label9";

this->label9->Size = System::Drawing::Size(95, 13);

this->label9->TabIndex = 13;

this->label9->Text = L"VENTA ENERO";

//

// label10

//

this->label10->AutoSize = true;

this->label10->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label10->Location = System::Drawing::Point(12,

368);

this->label10->Name = L"label10";

this->label10->Size = System::Drawing::Size(114, 13);

this->label10->TabIndex = 14;

this->label10->Text = L"VENTA FEBRERO";

//

// label11

//

this->label11->AutoSize = true;

this->label11->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label11->Location = System::Drawing::Point(23,

406);

this->label11->Name = L"label11";

this->label11->Size = System::Drawing::Size(100, 13);

this->label11->TabIndex = 15;

this->label11->Text = L"VENTA MARZO";

//

// textBox2

//

Page 26: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 26

this->textBox2->Location =

System::Drawing::Point(129, 330);

this->textBox2->Name = L"textBox2";

this->textBox2->Size = System::Drawing::Size(100,

20);

this->textBox2->TabIndex = 16;

//

// textBox3

//

this->textBox3->Location =

System::Drawing::Point(129, 365);

this->textBox3->Name = L"textBox3";

this->textBox3->Size = System::Drawing::Size(100,

20);

this->textBox3->TabIndex = 17;

//

// textBox4

//

this->textBox4->Location =

System::Drawing::Point(129, 402);

this->textBox4->Name = L"textBox4";

this->textBox4->Size = System::Drawing::Size(100,

20);

this->textBox4->TabIndex = 18;

//

// label12

//

this->label12->AutoSize = true;

this->label12->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label12->Location = System::Drawing::Point(306,

311);

this->label12->Name = L"label12";

this->label12->Size = System::Drawing::Size(184, 13);

this->label12->TabIndex = 19;

this->label12->Text = L"VENTA TOTAL- I TRIMESTRE";

//

// textBox5

//

this->textBox5->Location =

System::Drawing::Point(347, 339);

this->textBox5->Name = L"textBox5";

this->textBox5->Size = System::Drawing::Size(100,

20);

this->textBox5->TabIndex = 20;

//

// label13

//

this->label13->AutoSize = true;

this->label13->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->label13->Location = System::Drawing::Point(284,

372);

this->label13->Name = L"label13";

this->label13->Size = System::Drawing::Size(206, 13);

Page 27: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 27

this->label13->TabIndex = 21;

this->label13->Text = L"VENTA PROMEDIO- I TRIMESTRE";

//

// textBox6

//

this->textBox6->Location =

System::Drawing::Point(347, 406);

this->textBox6->Name = L"textBox6";

this->textBox6->Size = System::Drawing::Size(100,

20);

this->textBox6->TabIndex = 22;

//

// button4

//

this->button4->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->button4->Location = System::Drawing::Point(129,

448);

this->button4->Name = L"button4";

this->button4->Size = System::Drawing::Size(132, 42);

this->button4->TabIndex = 23;

this->button4->Text = L"CALCULAR";

this->button4->UseVisualStyleBackColor = true;

this->button4->Click += gcnew

System::EventHandler(this, &Form1::button4_Click);

//

// button5

//

this->button5->Font = (gcnew

System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,

System::Drawing::FontStyle::Bold,

System::Drawing::GraphicsUnit::Point,

static_cast<System::Byte>(0)));

this->button5->Location = System::Drawing::Point(375,

179);

this->button5->Name = L"button5";

this->button5->Size = System::Drawing::Size(100, 30);

this->button5->TabIndex = 24;

this->button5->Text = L"MOSTRAR";

this->button5->UseVisualStyleBackColor = true;

this->button5->Click += gcnew

System::EventHandler(this, &Form1::button5_Click);

//

// Form1

//

this->AutoScaleDimensions = System::Drawing::SizeF(6,

13);

this->AutoScaleMode =

System::Windows::Forms::AutoScaleMode::Font;

this->ClientSize = System::Drawing::Size(515, 516);

this->Controls->Add(this->button5);

this->Controls->Add(this->button4);

this->Controls->Add(this->textBox6);

this->Controls->Add(this->label13);

this->Controls->Add(this->textBox5);

this->Controls->Add(this->label12);

this->Controls->Add(this->textBox4);

this->Controls->Add(this->textBox3);

Page 28: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 28

this->Controls->Add(this->textBox2);

this->Controls->Add(this->label11);

this->Controls->Add(this->label10);

this->Controls->Add(this->label9);

this->Controls->Add(this->button3);

this->Controls->Add(this->button2);

this->Controls->Add(this->button1);

this->Controls->Add(this->textBox1);

this->Controls->Add(this->listBox1);

this->Controls->Add(this->label8);

this->Controls->Add(this->label7);

this->Controls->Add(this->label6);

this->Controls->Add(this->label5);

this->Controls->Add(this->label4);

this->Controls->Add(this->label3);

this->Controls->Add(this->label2);

this->Controls->Add(this->label1);

this->Name = L"Form1";

this->Text = L"Form1";

this->ResumeLayout(false);

this->PerformLayout();

}

private: System::Void button1_Click(System::Object^ sender,

System::EventArgs^ e) {

matriz[c][f]=Convert::ToInt32(textBox1->Text);

cont++;

if(f==0){

auxi=auxi+matriz[c][f];

}

if(f==1){

auxi2=auxi2+matriz[c][f];

}

if(f==2){

auxi3=auxi3+matriz[c][f];

}

f++;

if(f==3){

c++;

f=0;

}

if(cont==9){

button1->Enabled=false;

}

textBox1->Text="";

textBox1->Focus();

}

private: System::Void button5_Click(System::Object^ sender,

System::EventArgs^ e) {

int c=0;

for (int f=0;f<3;f++){

listBox1->Items-

>Add(matriz[f][c]+"\t"+matriz[f][c+1]+"\t"+matriz[f][c+2]);

listBox1->Items->Add("\n");

}

}

private: System::Void button4_Click(System::Object^ sender,

System::EventArgs^ e) {

textBox2->Text=String::Format("{0:F2}",auxi);

textBox3->Text=String::Format("{0:F2}",auxi2);

Page 29: APLICACION DE MATRICES EN VISUAL C++

ESTRUCTURA DE INFORMACION

ESTRUCTURA DE INFORMACION Página 29

textBox4->Text=String::Format("{0:F2}",auxi3);

l=auxi+auxi2+auxi3;

textBox5->Text=String::Format("{0:F2}",l);

j=(auxi+auxi2+auxi3)/3;

textBox6->Text=String::Format("{0:F2}",j);

}

private: System::Void button2_Click(System::Object^ sender,

System::EventArgs^ e) {

textBox2->Text="";

textBox3->Text="";

textBox4->Text="";

textBox5->Text="";

textBox6->Text="";

listBox1->Items->Clear();

button1->Enabled=true;

f=0;

c=0;

cont=0;

auxi=0;

auxi2=0;

auxi3=0;

}

private: System::Void button3_Click(System::Object^ sender,

System::EventArgs^ e) {

Application::Exit();

}

};

}