APLICACION DE VECTORES EN VISUAL C++
Transcript of APLICACION DE VECTORES EN VISUAL C++
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
1/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 1
CURSO:ESTRUCTURA DE INFORMACION
DOCENTE:TORALVA GONZALES PAUL
FACULTAD:INGENIERIA DE SISTEMA CMPUTO Y
TELECOMUNICACIONES
INTEGRANTES:JUNIOR ALEJANDRO HURTADO AVALOS
CICLO: IV TURNO: NOCTURNO
2012
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
2/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 2
EJERCICIOS DESARROLLADOS DE LA PRACTICA N3
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
3/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 3
1)
#pragma once
namespace Vectores1 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
///
/// Resumen de Form1
///
/// ADVERTENCIA: si cambia el nombre de esta clase, deber cambiar la
/// propiedad 'Nombre de archivos de recursos' de la herramienta de
compilacin de recursos administrados
/// asociada con todos los archivos .resx de los que depende esta clase.
De lo contrario,
/// los diseadores no podrn interactuar correctamente con los
/// recursos adaptados asociados con este formulario.
///
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void){
InitializeComponent();
//
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
4/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 4
//TODO: agregar cdigo de constructor aqu
//
}
protected:
///
/// Limpiar los recursos que se estn utilizando.
///
~Form1(){
if (components){
delete components;}}
private: System::Windows::Forms::Label^ label1;
protected:
private: System::Windows::Forms::Label^ label2;
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::ListBox^ listBox1;
private:
///
/// Variable del diseador requerida.
static array ^ nombres = gcnew array(7);
static int x=0;
///
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
///
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
5/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 5
/// Mtodo necesario para admitir el Diseador. No se puede modificar
/// el contenido del mtodo con el editor de cdigo.
///
void InitializeComponent(void){
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
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->listBox1 = (gcnew System::Windows::Forms::ListBox());
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
9.75F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->label1->Location = System::Drawing::Point(137, 23);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(131, 16);
this->label1->TabIndex = 0;
this->label1->Text = L"Datos personales";
//
// label2
//
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
6/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 6
this->label2->AutoSize = true;
this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
8.25F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->label2->Location = System::Drawing::Point(23, 69);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(121, 13);
this->label2->TabIndex = 1;
this->label2->Text = L"Apellidos y Nombres";
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(150, 66);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(124, 20);
this->textBox1->TabIndex = 2;
//
// button1
//
this->button1->Location = System::Drawing::Point(26, 140);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 39);
this->button1->TabIndex = 3;
this->button1->Text = L"Ingresar";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this,
&Form1::button1_Click);
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
7/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 7
//
// button2
//
this->button2->Location = System::Drawing::Point(295, 66);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(75, 32);
this->button2->TabIndex = 4;
this->button2->Text = L"Mostrar";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this,
&Form1::button2_Click);
//
// button3
//
this->button3->Location = System::Drawing::Point(120, 140);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(75, 39);
this->button3->TabIndex = 5;
this->button3->Text = L"Nuevo";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this,
&Form1::button3_Click);
//
// listBox1
//
this->listBox1->FormattingEnabled = true;
this->listBox1->Location = System::Drawing::Point(217, 140);
this->listBox1->Name = L"listBox1";
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
8/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 8
this->listBox1->Size = System::Drawing::Size(153, 160);
this->listBox1->TabIndex = 6;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(400, 345);
this->Controls->Add(this->listBox1);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();}
#pragma endregion
private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e) {}
private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e) {
nombres[x]=textBox1->Text;
x++;
textBox1->Text="";
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
9/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 9
textBox1->Focus();
if(x==7){
button1->Enabled=false;}}
private: System::Void button3_Click(System::Object^ sender,
System::EventArgs^ e) {
listBox1->Items->Clear();
button1->Enabled=true;
x=0;}
private: System::Void button2_Click(System::Object^ sender,
System::EventArgs^ e) {
for(int t=0;tItems->Add((t+1)+")"+nombres[t]);
} }
private: System::Void textBox1_KeyDown(System::Object^ sender,
System::Windows::Forms::KeyEventArgs^ e) {
if(e->KeyCode == System::Windows::Forms::Keys::Enter)
button1->Focus();}};}
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
10/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 10
2)
#pragma once
namespace Vectores1 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
///
/// Resumen de Form1
///
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
11/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 11
/// ADVERTENCIA: si cambia el nombre de esta clase, deber cambiar la
/// propiedad 'Nombre de archivos de recursos' de la herramienta de
compilacin de recursos administrados
/// asociada con todos los archivos .resx de los que depende esta clase.De lo contrario,
/// los diseadores no podrn interactuar correctamente con los
/// recursos adaptados asociados con este formulario.
///
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: agregar cdigo de constructor aqu
//
}
protected:
///
/// Limpiar los recursos que se estn utilizando.
///
~Form1(){
if (components){
delete components;}}
protected:
private:
///
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
12/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 12
/// Variable del diseador requerida.
static int x=0;
static array ^ numeros=gcnew array (5);
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::ListBox^ listBox1;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::ListBox^ listBox2;
private: System::Windows::Forms::ListBox^ listBox3;
///
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
///
/// Mtodo necesario para admitir el Diseador. No se puede modificar
/// el contenido del mtodo con el editor de cdigo.
///
void InitializeComponent(void){
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->listBox1 = (gcnew System::Windows::Forms::ListBox());
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
13/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 13
this->label3 = (gcnew System::Windows::Forms::Label());
this->label4 = (gcnew System::Windows::Forms::Label());
this->listBox2 = (gcnew System::Windows::Forms::ListBox());
this->listBox3 = (gcnew System::Windows::Forms::ListBox());
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
9.75F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->label1->Location = System::Drawing::Point(103, 26);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(226, 16);
this->label1->TabIndex = 0;
this->label1->Text = L"VECTORES- PARES- IMPARES";
//
// 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(0)));
this->label2->Location = System::Drawing::Point(48, 76);
this->label2->Name = L"label2";
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
14/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 14
this->label2->Size = System::Drawing::Size(70, 16);
this->label2->TabIndex = 1;
this->label2->Text = L"Numeros";
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(142, 77);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(149, 20);
this->textBox1->TabIndex = 2;
//
// listBox1
//
this->listBox1->FormattingEnabled = true;
this->listBox1->Location = System::Drawing::Point(61, 123);
this->listBox1->Name = L"listBox1";
this->listBox1->Size = System::Drawing::Size(181, 95);
this->listBox1->TabIndex = 3;
//
// button1
//
this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
8.25F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->button1->Location = System::Drawing::Point(286, 136);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(103, 44);
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
15/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 15
this->button1->TabIndex = 4;
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",
9.75F, System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->button2->Location = System::Drawing::Point(172, 237);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(107, 47);
this->button2->TabIndex = 5;
this->button2->Text = L"Reporte";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this,
&Form1::button2_Click);
//
// 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(0)));
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
16/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 16
this->label3->Location = System::Drawing::Point(76, 316);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(39, 13);
this->label3->TabIndex = 6;
this->label3->Text = L"Pares";
//
// 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(0)));
this->label4->Location = System::Drawing::Point(319, 316);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(51, 13);
this->label4->TabIndex = 7;
this->label4->Text = L"Impares";
//
// listBox2
//
this->listBox2->FormattingEnabled = true;
this->listBox2->Location = System::Drawing::Point(51, 351);
this->listBox2->Name = L"listBox2";
this->listBox2->Size = System::Drawing::Size(120, 95);
this->listBox2->TabIndex = 8;
//
// listBox3
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
17/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 17
//
this->listBox3->FormattingEnabled = true;
this->listBox3->Location = System::Drawing::Point(269, 351);
this->listBox3->Name = L"listBox3";
this->listBox3->Size = System::Drawing::Size(129, 95);
this->listBox3->TabIndex = 9;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(441, 482);
this->Controls->Add(this->listBox3);
this->Controls->Add(this->listBox2);
this->Controls->Add(this->label4);
this->Controls->Add(this->label3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Controls->Add(this->listBox1);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();}
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
18/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 18
#pragma endregion
private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e) {}
private: System::Void button1_Click(System::Object^ sender,System::EventArgs^ e) {
numeros[x]=Int32::Parse(textBox1->Text);
x++;
listBox1->Items->Add((x)+") "+textBox1->Text);
textBox1->Text="";
textBox1->Focus();
if(x==5){
button1->Enabled = false;}}
private: System::Void button2_Click(System::Object^ sender,
System::EventArgs^ e) {
int p,i;p=i=0;
for(int a=0;aItems->Add("Total pares:"+p);
listBox3->Items->Add("Total impares:"+i);
for(int b=0;bItems->Add(numeros[b]);}
else{
listBox3->Items->Add(numeros[b]);}
} }
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
19/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 19
private: System::Void button1_KeyDown(System::Object^ sender,
System::Windows::Forms::KeyEventArgs^ e) {
if(e->KeyCode == System::Windows::Forms::Keys::Enter)
button1->Focus();}
};
}
3)
#pragma once
namespace Vectores1 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
20/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 20
using namespace System::Drawing;
///
/// Resumen de Form1
///
/// ADVERTENCIA: si cambia el nombre de esta clase, deber cambiar la
/// propiedad 'Nombre de archivos de recursos' de la herramienta de
compilacin de recursos administrados
/// asociada con todos los archivos .resx de los que depende esta clase.
De lo contrario,
/// los diseadores no podrn interactuar correctamente con los
/// recursos adaptados asociados con este formulario.
///
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void){
InitializeComponent();
//
//TODO: agregar cdigo de constructor aqu
//
}
protected:
///
/// Limpiar los recursos que se estn utilizando.
///
~Form1(){
if (components){
delete components;}}
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
21/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 21
protected:
private:
///
/// Variable del diseador requerida.
static int x=0,y=0;
static array ^ numeros=gcnew array (5);
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::Button^ button3;
private: System::Windows::Forms::Button^ button4;
private: System::Windows::Forms::ListBox^ listBox1;
private: System::Windows::Forms::Button^ button5;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::TextBox^ textBox2;
///
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
///
/// Mtodo necesario para admitir el Diseador. No se puede modificar
/// el contenido del mtodo con el editor de cdigo.
///
void InitializeComponent(void){
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
22/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 22
this->label3 = (gcnew System::Windows::Forms::Label());
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->button4 = (gcnew System::Windows::Forms::Button());
this->listBox1 = (gcnew System::Windows::Forms::ListBox());
this->button5 = (gcnew System::Windows::Forms::Button());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",9.75F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->label1->Location = System::Drawing::Point(168, 36);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(112, 16);
this->label1->TabIndex = 0;
this->label1->Text = L"CONCATENAR";
//
// label2
//
this->label2->AutoSize = true;
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
23/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 23
this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
8.25F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->label2->Location = System::Drawing::Point(73, 69);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(51, 13);
this->label2->TabIndex = 1;
this->label2->Text = L"Vector1";
//
// 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(0)));
this->label3->Location = System::Drawing::Point(312, 69);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(51, 13);
this->label3->TabIndex = 2;
this->label3->Text = L"Vector2";
//
// button1
//
this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
8.25F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
24/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 24
this->button1->Location = System::Drawing::Point(40, 132);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(115, 39);
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(0)));
this->button2->Location = System::Drawing::Point(286, 128);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(107, 43);
this->button2->TabIndex = 4;
this->button2->Text = L"Ingresar";
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, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
25/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 25
static_cast(0)));
this->button3->Location = System::Drawing::Point(171, 200);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(116, 53);
this->button3->TabIndex = 5;
this->button3->Text = L"Resultado";
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(0)));
this->button4->Location = System::Drawing::Point(24, 297);
this->button4->Name = L"button4";
this->button4->Size = System::Drawing::Size(109, 46);
this->button4->TabIndex = 6;
this->button4->Text = L"Nuevo";
this->button4->UseVisualStyleBackColor = true;
this->button4->Click += gcnew System::EventHandler(this,
&Form1::button4_Click);
//
// listBox1
//
this->listBox1->FormattingEnabled = true;
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
26/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 26
this->listBox1->Location = System::Drawing::Point(163, 297);
this->listBox1->Name = L"listBox1";
this->listBox1->Size = System::Drawing::Size(130, 147);
this->listBox1->TabIndex = 7;
//
// button5
//
this->button5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
8.25F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->button5->Location = System::Drawing::Point(315, 297);
this->button5->Name = L"button5";
this->button5->Size = System::Drawing::Size(94, 46);
this->button5->TabIndex = 8;
this->button5->Text = L"Salir";
this->button5->UseVisualStyleBackColor = true;
this->button5->Click += gcnew System::EventHandler(this,
&Form1::button5_Click);
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(40, 94);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(115, 20);
this->textBox1->TabIndex = 9;
//
// textBox2
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
27/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 27
//
this->textBox2->Location = System::Drawing::Point(286, 94);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(107, 20);
this->textBox2->TabIndex = 10;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(441, 482);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->button5);
this->Controls->Add(this->listBox1);
this->Controls->Add(this->button4);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Controls->Add(this->label3);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();}
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
28/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 28
#pragma endregion
private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e) {
}
private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e) {
numeros[x]=Int32::Parse(textBox1->Text);
x++;
listBox1->Items->Add((x)+") "+textBox1->Text);
textBox1->Text="";
textBox1->Focus();
if(x==5) {
button1->Enabled = false;}}
private: System::Void button2_Click(System::Object^ sender,
System::EventArgs^ e) {
numeros[y]=Int32::Parse(textBox2->Text);
y++;
listBox1->Items->Add((y)+") "+textBox2->Text);
textBox2->Text="";
textBox2->Focus();
if(x==5){
button2->Enabled = false;}}
private: System::Void button4_Click(System::Object^ sender,
System::EventArgs^ e) {
listBox1->Items->Clear();
button1->Enabled=true;
x=0;
y=0;}
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
29/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 29
private: System::Void button3_Click(System::Object^ sender,
System::EventArgs^ e) {
for(int t=0;tItems->Add((x)+")"+numeros[t]);
listBox1->Items->Add((y)+")"+numeros[t]);
} }
private: System::Void button5_Click(System::Object^ sender,
System::EventArgs^ e) {
Application::Exit();
}
};
}
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
30/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 30
4)
#pragma once
namespace Vectores1 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
///
/// Resumen de Form1
///
/// ADVERTENCIA: si cambia el nombre de esta clase, deber cambiar la
/// propiedad 'Nombre de archivos de recursos' de la herramienta de
compilacin de recursos administrados
/// asociada con todos los archivos .resx de los que depende esta clase.
De lo contrario,
/// los diseadores no podrn interactuar correctamente con los
/// recursos adaptados asociados con este formulario.
///
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void){
InitializeComponent();
//
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
31/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 31
//TODO: agregar cdigo de constructor aqu
//
}
protected:
///
/// Limpiar los recursos que se estn utilizando.
///
~Form1(){
if (components){
delete components;}}
protected:
private:
///
/// Variable del diseador requerida.
static int x=0;
static array ^ numeros=gcnew array (6);
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::TextBox^ textBox2;
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::Button^ button3;
private: System::Windows::Forms::Button^ button4;
private: System::Windows::Forms::ListBox^ listBox1;
private: System::Windows::Forms::Label^ label4;
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
32/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 32
private: System::Windows::Forms::Label^ label5;
private: System::Windows::Forms::Label^ label6;
private: System::Windows::Forms::TextBox^ textBox3;
private: System::Windows::Forms::ListBox^ listBox2;
///
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
///
/// Mtodo necesario para admitir el Diseador. No se puede modificar
/// el contenido del mtodo con el editor de cdigo.
///
void InitializeComponent(void){
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->label3 = (gcnew System::Windows::Forms::Label());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->button4 = (gcnew System::Windows::Forms::Button());
this->listBox1 = (gcnew System::Windows::Forms::ListBox());
this->label4 = (gcnew System::Windows::Forms::Label());
this->label5 = (gcnew System::Windows::Forms::Label());
this->label6 = (gcnew System::Windows::Forms::Label());
this->textBox3 = (gcnew System::Windows::Forms::TextBox());
this->listBox2 = (gcnew System::Windows::Forms::ListBox());
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
33/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 33
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(0)));
this->label1->Location = System::Drawing::Point(182, 26);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(84, 20);
this->label1->TabIndex = 0;
this->label1->Text = L"Promedio";
//
// 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(0)));
this->label2->Location = System::Drawing::Point(56, 76);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(74, 16);
this->label2->TabIndex = 1;
this->label2->Text = L"Apellidos";
//
// label3
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
34/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 34
//
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(0)));
this->label3->Location = System::Drawing::Point(90, 127);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(40, 13);
this->label3->TabIndex = 2;
this->label3->Text = L"Notas";
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(149, 72);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(219, 20);
this->textBox1->TabIndex = 3;
//
// textBox2
//
this->textBox2->Location = System::Drawing::Point(149, 127);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(100, 20);
this->textBox2->TabIndex = 4;
//
// button1
//
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
35/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 35
this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
9.75F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->button1->Location = System::Drawing::Point(307, 117);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(100, 33);
this->button1->TabIndex = 5;
this->button1->Text = L"Vector";
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",
9.75F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->button2->Location = System::Drawing::Point(307, 230);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(100, 45);
this->button2->TabIndex = 6;
this->button2->Text = L"Nuevo";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this,
&Form1::button2_Click);
//
// button3
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
36/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 36
//
this->button3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
9.75F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->button3->Location = System::Drawing::Point(149, 298);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(119, 40);
this->button3->TabIndex = 7;
this->button3->Text = L"Reporte";
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",
9.75F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->button4->Location = System::Drawing::Point(307, 172);
this->button4->Name = L"button4";
this->button4->Size = System::Drawing::Size(100, 37);
this->button4->TabIndex = 8;
this->button4->Text = L"Salir";
this->button4->UseVisualStyleBackColor = true;
this->button4->Click += gcnew System::EventHandler(this,
&Form1::button4_Click);
//
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
37/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 37
// listBox1
//
this->listBox1->FormattingEnabled = true;
this->listBox1->Location = System::Drawing::Point(148, 167);
this->listBox1->Name = L"listBox1";
this->listBox1->Size = System::Drawing::Size(133, 108);
this->listBox1->TabIndex = 9;
//
// label4
//
this->label4->AutoSize = true;
this->label4->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
9.75F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->label4->Location = System::Drawing::Point(66, 310);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(64, 16);
this->label4->TabIndex = 10;
this->label4->Text = L"Reporte";
//
// label5
//
this->label5->AutoSize = true;
this->label5->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
9.75F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
38/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 38
this->label5->Location = System::Drawing::Point(56, 367);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(74, 16);
this->label5->TabIndex = 11;
this->label5->Text = L"Apellidos";
//
// label6
//
this->label6->AutoSize = true;
this->label6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
9.75F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->label6->Location = System::Drawing::Point(55, 415);
this->label6->Name = L"label6";
this->label6->Size = System::Drawing::Size(75, 16);
this->label6->TabIndex = 12;
this->label6->Text = L"Promedio";
//
// textBox3
//
this->textBox3->Location = System::Drawing::Point(149, 367);
this->textBox3->Name = L"textBox3";
this->textBox3->Size = System::Drawing::Size(220, 20);
this->textBox3->TabIndex = 13;
//
// listBox2
//
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
39/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 39
this->listBox2->FormattingEnabled = true;
this->listBox2->Location = System::Drawing::Point(148, 415);
this->listBox2->Name = L"listBox2";
this->listBox2->Size = System::Drawing::Size(219, 30);
this->listBox2->TabIndex = 14;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(435, 475);
this->Controls->Add(this->listBox2);
this->Controls->Add(this->textBox3);
this->Controls->Add(this->label6);
this->Controls->Add(this->label5);
this->Controls->Add(this->label4);
this->Controls->Add(this->listBox1);
this->Controls->Add(this->button4);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->label3);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Name = L"Form1";
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
40/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 40
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();}
#pragma endregion
private: System::Void Form1_Load(System::Object^ sender,
System::EventArgs^ e) {
}
private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e) {
numeros[x]=Int32::Parse(textBox2->Text);
x++;
listBox1->Items->Add((x)+") "+textBox2->Text);
textBox2->Text="";
textBox2->Focus();
if(x==6){
button1->Enabled = false;}}
private: System::Void button2_Click(System::Object^ sender,
System::EventArgs^ e) {
listBox1->Items->Clear();
listBox2->Items->Clear();
button1->Enabled=true;
x=0;}
private: System::Void button3_Click(System::Object^ sender,
System::EventArgs^ e) {
int a=0,d=0,i,s=0,p=0;
for(i=0;i
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
41/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 41
p=s/6;
if(p>10){
listBox2->Items->Add("aprobado "+p);
a++;}
else{
listBox2->Items->Add("Desaprobado "+p);
d++;}}
private: System::Void button4_Click(System::Object^ sender,
System::EventArgs^ e) {
Application::Exit();}
};
}
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
42/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 42
5)
#pragma once
namespace Vectores1 {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
///
/// Resumen de Form1
///
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void){
InitializeComponent();
//
//TODO: agregar cdigo de constructor aqu
//
}
protected:
///
/// Limpiar los recursos que se estn utilizando.
///
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
43/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 43
~Form1(){
if (components){
delete components;}}
private: System::Windows::Forms::Label^ label1;
protected:
private: System::Windows::Forms::Button^ button1;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::ListBox^ listBox1;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::Button^ button3;
private:
///
/// Variable del diseador requerida.
static int x=0;
static array ^ numero=gcnew array(5);
private: System::Windows::Forms::TextBox^ textBox2;
///
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
///
/// Mtodo necesario para admitir el Diseador. No se puede modificar
/// el contenido del mtodo con el editor de cdigo.
///
void InitializeComponent(void){
this->label1 = (gcnew System::Windows::Forms::Label());
this->button1 = (gcnew System::Windows::Forms::Button());
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
44/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 44
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->label2 = (gcnew System::Windows::Forms::Label());
this->listBox1 = (gcnew System::Windows::Forms::ListBox());
this->button2 = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->SuspendLayout();
//
// label1
//
this->label1->AutoSize = true;
this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
9.75F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->label1->Location = System::Drawing::Point(133, 26);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(109, 16);
this->label1->TabIndex = 0;
this->label1->Text = L"Numero Mayor";
//
// button1
//
this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
8.25F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->button1->Location = System::Drawing::Point(24, 55);
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
45/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 45
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(98, 26);
this->button1->TabIndex = 1;
this->button1->Text = L"Ingresar";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this,
&Form1::button1_Click);
this->button1->KeyDown += gcnew
System::Windows::Forms::KeyEventHandler(this, &Form1::button1_KeyDown);
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(150, 61);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(149, 20);
this->textBox1->TabIndex = 2;
//
// 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(0)));
this->label2->Location = System::Drawing::Point(41, 236);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(131, 16);
this->label2->TabIndex = 3;
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
46/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 46
this->label2->Text = L"numero mayor es:";
//
// listBox1
//
this->listBox1->FormattingEnabled = true;
this->listBox1->Location = System::Drawing::Point(83, 93);
this->listBox1->Name = L"listBox1";
this->listBox1->Size = System::Drawing::Size(171, 69);
this->listBox1->TabIndex = 4;
//
// button2
//
this->button2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
8.25F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->button2->Location = System::Drawing::Point(24, 181);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(123, 28);
this->button2->TabIndex = 6;
this->button2->Text = L"Mostrar";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this,
&Form1::button2_Click);
//
// button3
//
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
47/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 47
this->button3->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif",
8.25F, System::Drawing::FontStyle::Bold,
System::Drawing::GraphicsUnit::Point,
static_cast(0)));
this->button3->Location = System::Drawing::Point(197, 181);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(110, 28);
this->button3->TabIndex = 7;
this->button3->Text = L"Salir";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this,
&Form1::button3_Click);
//
// textBox2
//
this->textBox2->Location = System::Drawing::Point(200, 236);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(117, 20);
this->textBox2->TabIndex = 8;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(347, 283);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
48/49
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 48
this->Controls->Add(this->listBox1);
this->Controls->Add(this->label2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->button1);
this->Controls->Add(this->label1);
this->Name = L"Form1";
this->Text = L"Arreglo de Vectores";
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e) {
numero[x]=Int32::Parse(textBox1->Text);
x++;
listBox1->Items->Add((x)+") "+textBox1->Text);
textBox1->Text="";
textBox1->Focus();
if(x==5){
button1->Enabled=false;}}
private: System::Void button2_Click(System::Object^ sender,
System::EventArgs^ e) {
int m=numero[0],i;
for(i=0;im){
m=numero[i];}
textBox2->Text=(""+m);}}
-
7/31/2019 APLICACION DE VECTORES EN VISUAL C++
49/49
ESTRUCTURA DE INFORMACION
private: System::Void button1_KeyDown(System::Object^ sender,
System::Windows::Forms::KeyEventArgs^ e){
if(e->KeyCode==System::Windows::Forms::Keys::Enter) button1->Focus();
}
private: System::Void button3_Click(System::Object^ sender,
System::EventArgs^ e) {
Application::Exit();
}
};
}