Post on 05-Apr-2018
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
1/23
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 ORDENAMIENTO DE VECTORES EN C++
2/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 2
EJERCICIOS DESARROLLADOS DE LA PRACTICA N5
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
3/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 3
1)
#pragmaonce
namespace ordenamiento {usingnamespace System;
usingnamespace System::ComponentModel;usingnamespace System::Collections;usingnamespace System::Windows::Forms;usingnamespace System::Data;usingnamespace 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./// publicrefclass 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;}
}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::ListBox^ listBox1;private: System::Windows::Forms::ListBox^ listBox2;private: System::Windows::Forms::Button^ button2;private: System::Windows::Forms::Button^ button3;private: System::Windows::Forms::Button^ button4;private: System::Windows::Forms::Button^ button5;
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
4/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 4
private:/// /// Variable del diseador requerida.staticint x=0;staticarray ^ numero=gcnewarray(7);///
System::ComponentModel::Container ^components;
#pragmaregion 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 = (gcnewSystem::Windows::Forms::Label());
this->label2 = (gcnew
System::Windows::Forms::Label());this->textBox1 = (gcnewSystem::Windows::Forms::TextBox());
this->button1 = (gcnewSystem::Windows::Forms::Button());
this->listBox1 = (gcnewSystem::Windows::Forms::ListBox());
this->listBox2 = (gcnewSystem::Windows::Forms::ListBox());
this->button2 = (gcnewSystem::Windows::Forms::Button());
this->button3 = (gcnewSystem::Windows::Forms::Button());
this->button4 = (gcnewSystem::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(0)));this->label1->Location = System::Drawing::Point(72,
32);this->label1->Name = L"label1";this->label1->Size = System::Drawing::Size(308, 20);this->label1->TabIndex = 0;this->label1->Text = L"ORDENAMIENTO DE 7 ELEMENTOS";//// label2//this->label2->AutoSize = true;this->label2->Location = System::Drawing::Point(12,
83);this->label2->Name = L"label2";this->label2->Size = System::Drawing::Size(108, 13);this->label2->TabIndex = 1;
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
5/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 5
this->label2->Text = L"INGRESE VALORES";//// textBox1//this->textBox1->Location =
System::Drawing::Point(140, 83);
this->textBox1->Name = L"textBox1";this->textBox1->Size = System::Drawing::Size(159,20);
this->textBox1->TabIndex = 2;//// button1//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(318,
83); this->button1->Name = L"button1";this->button1->Size = System::Drawing::Size(112, 40);this->button1->TabIndex = 3;this->button1->Text = L"INGRESE";this->button1->UseVisualStyleBackColor = true;this->button1->Click += gcnew
System::EventHandler(this, &Form1::button1_Click);//// listBox1//this->listBox1->FormattingEnabled = true;this->listBox1->Location = System::Drawing::Point(60,
159); this->listBox1->Name = L"listBox1";this->listBox1->Size = System::Drawing::Size(205,
95);this->listBox1->TabIndex = 4;//// listBox2//this->listBox2->FormattingEnabled = true;this->listBox2->Location = System::Drawing::Point(60,
280);this->listBox2->Name = L"listBox2";this->listBox2->Size = System::Drawing::Size(205,
95);this->listBox2->TabIndex = 5;//// 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(309,
181);this->button2->Name = L"button2";this->button2->Size = System::Drawing::Size(121, 51);this->button2->TabIndex = 6;this->button2->Text = L"MOSTRAR";
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
6/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 6
this->button2->UseVisualStyleBackColor = true;this->button2->Click += gcnew
System::EventHandler(this, &Form1::button2_Click);//// button3//
this->button3->Font = (gcnewSystem::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(309,
299);this->button3->Name = L"button3";this->button3->Size = System::Drawing::Size(121, 58);this->button3->TabIndex = 7;this->button3->Text = L"ORDENAR";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(87,
405);this->button4->Name = L"button4";this->button4->Size = System::Drawing::Size(115, 51);
this->button4->TabIndex = 8;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", 9.75F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,
static_cast(0)));this->button5->Location = System::Drawing::Point(263,
405);this->button5->Name = L"button5";this->button5->Size = System::Drawing::Size(117, 51);this->button5->TabIndex = 9;this->button5->Text = L"SALIR";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;
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
7/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 7
this->ClientSize = System::Drawing::Size(463, 491);this->Controls->Add(this->button5);this->Controls->Add(this->button4);this->Controls->Add(this->button3);this->Controls->Add(this->button2);this->Controls->Add(this->listBox2);
this->Controls->Add(this->listBox1);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();
}
#pragmaendregionprivate: System::Void button1_Click(System::Object^ sender,System::EventArgs^ e) {
numero[x]=Int32::Parse(textBox1->Text);x++;textBox1->Text="";textBox1->Focus();if(x==7){button1->Enabled=false;}}
private: System::Void button2_Click(System::Object^ sender,System::EventArgs^ e) {
for(int t=0;tItems->Add((t+1)+") "+numero[t]);}
}private: System::Void button3_Click(System::Object^ sender,System::EventArgs^ e) {
int temp,max=7;for(int i=1;iClear();listBox2->Items->Clear();button1->Enabled=true;x=0;
}private: System::Void button5_Click(System::Object^ sender,System::EventArgs^ e) {
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
8/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 8
Application::Exit();}
private: System::Void Form1_Load(System::Object^ sender,System::EventArgs^ e) {
System::Windows::Forms::MessageBox::Show( "ORDENAMIENTO-MTODO BURBUJA");
}};}
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
9/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 9
2)
#pragmaoncenamespace ordenamiento {
usingnamespace System;usingnamespace System::ComponentModel;
usingnamespace System::Collections;usingnamespace System::Windows::Forms;usingnamespace System::Data;usingnamespace 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 correctamentecon los
/// recursos adaptados asociados con este formulario./// publicrefclass 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:
/// /// Variable del diseador requerida.staticint x=0;staticarray ^ numero=gcnewarray(5);
private: System::Windows::Forms::Label^ label1;private: System::Windows::Forms::Label^ label2;private: System::Windows::Forms::TextBox^ textBox1;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::ListBox^ listBox2;private: System::Windows::Forms::Button^ button3;
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
10/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 10
private: System::Windows::Forms::Button^ button4;///
System::ComponentModel::Container ^components;
#pragmaregion Windows Form Designer generated code///
/// Mtodo necesario para admitir el Diseador. No se puedemodificar/// el contenido del mtodo con el editor de cdigo./// void InitializeComponent(void){
this->label1 = (gcnewSystem::Windows::Forms::Label());
this->label2 = (gcnewSystem::Windows::Forms::Label());
this->textBox1 = (gcnewSystem::Windows::Forms::TextBox());
this->label3 = (gcnew
System::Windows::Forms::Label());this->button1 = (gcnewSystem::Windows::Forms::Button());
this->button2 = (gcnewSystem::Windows::Forms::Button());
this->listBox1 = (gcnewSystem::Windows::Forms::ListBox());
this->listBox2 = (gcnewSystem::Windows::Forms::ListBox());
this->button3 = (gcnewSystem::Windows::Forms::Button());
this->button4 = (gcnewSystem::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(0)));this->label1->Location = System::Drawing::Point(147,
24);this->label1->Name = L"label1";this->label1->Size = System::Drawing::Size(260, 20);this->label1->TabIndex = 0;this->label1->Text = L"ORDENAMIENTO DE EDADES";//// label2//this->label2->AutoSize = true;this->label2->Font = (gcnew
System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,System::Drawing::FontStyle::Regular,System::Drawing::GraphicsUnit::Point,
static_cast(0)));this->label2->Location = System::Drawing::Point(12,
92);this->label2->Name = L"label2";this->label2->Size = System::Drawing::Size(37, 13);
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
11/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 11
this->label2->TabIndex = 1;this->label2->Text = L"EDAD";//// textBox1//this->textBox1->Location = System::Drawing::Point(55,
89); this->textBox1->Name = L"textBox1";this->textBox1->Size = System::Drawing::Size(50, 20);this->textBox1->TabIndex = 2;//// 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(304,151);this->label3->Name = L"label3";this->label3->Size = System::Drawing::Size(131, 13);this->label3->TabIndex = 3;this->label3->Text = L"VECTOR ORDENADO";//// button1//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(127,73);
this->button1->Name = L"button1";this->button1->Size = System::Drawing::Size(114, 54);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(319,
75);this->button2->Name = L"button2";this->button2->Size = System::Drawing::Size(116, 50);this->button2->TabIndex = 5;this->button2->Text = L"ORDENAR";this->button2->UseVisualStyleBackColor = true;this->button2->Click += gcnew
System::EventHandler(this, &Form1::button2_Click);//// listBox1
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
12/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 12
//this->listBox1->FormattingEnabled = true;this->listBox1->Location = System::Drawing::Point(40,
181);this->listBox1->Name = L"listBox1";this->listBox1->Size = System::Drawing::Size(201,
95); this->listBox1->TabIndex = 6;//// listBox2//this->listBox2->FormattingEnabled = true;this->listBox2->Location =
System::Drawing::Point(277, 181);this->listBox2->Name = L"listBox2";this->listBox2->Size = System::Drawing::Size(185,
95);this->listBox2->TabIndex = 7;//
// button3//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(127,
303);this->button3->Name = L"button3";this->button3->Size = System::Drawing::Size(114, 53);this->button3->TabIndex = 8;this->button3->Text = L"NUEVO";
this->button3->UseVisualStyleBackColor = true;this->button3->Click += gcnewSystem::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(316,
303);this->button4->Name = L"button4";this->button4->Size = System::Drawing::Size(119, 53);this->button4->TabIndex = 9;this->button4->Text = L"SALIR";this->button4->UseVisualStyleBackColor = true;this->button4->Click += gcnew
System::EventHandler(this, &Form1::button4_Click);//// Form1//this->AutoScaleDimensions = System::Drawing::SizeF(6,
13);this->AutoScaleMode =
System::Windows::Forms::AutoScaleMode::Font;this->ClientSize = System::Drawing::Size(523, 395);this->Controls->Add(this->button4);
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
13/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 13
this->Controls->Add(this->button3);this->Controls->Add(this->listBox2);this->Controls->Add(this->listBox1);this->Controls->Add(this->button2);this->Controls->Add(this->button1);this->Controls->Add(this->label3);
this->Controls->Add(this->textBox1);this->Controls->Add(this->label2);this->Controls->Add(this->label1);this->Name = L"Form1";this->Text = L"ORDENAMIENTO DE VECTORES";this->Load += gcnew System::EventHandler(this,
&Form1::Form1_Load);this->ResumeLayout(false);this->PerformLayout();
}
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 temp,max=5,j;
for(int i=1;i=0 && numero[j]>temp ;j--){numero[j+1]=numero[j];}numero[j+1]=temp;}for(int x=0;xItems->Add((x+1)+") "+numero[x]);}}
private: System::Void button3_Click(System::Object^ sender,System::EventArgs^ e) {
listBox1->Items->Clear();listBox2->Items->Clear();button1->Enabled=true;x=0;}
private: System::Void Form1_Load(System::Object^ sender,System::EventArgs^ e) {
System::Windows::Forms::MessageBox::Show( "ORDENAMIENTO-MTODOINSERCIN");
}private: System::Void button4_Click(System::Object^ sender,System::EventArgs^ e) {
Application::Exit();}
};
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
14/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 14
}
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
15/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 15
3)
#pragmaoncenamespace ordenamientodevectores {
usingnamespace System;usingnamespace System::ComponentModel;usingnamespace System::Collections;usingnamespace System::Windows::Forms;usingnamespace System::Data;usingnamespace 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 quedepende esta clase. De lo contrario,
/// los diseadores no podrn interactuar correctamentecon los
/// recursos adaptados asociados con este formulario./// publicrefclass 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:
/// /// Variable del diseador requerida.staticint x=0;staticarray ^ numero=gcnewarray(4);
private: System::Windows::Forms::Label^ label1;private: System::Windows::Forms::Label^ label2;private: System::Windows::Forms::Label^ label3;private: System::Windows::Forms::Label^ label4;
private: System::Windows::Forms::TextBox^ textBox1;private: System::Windows::Forms::TextBox^ textBox2;private: System::Windows::Forms::TextBox^ textBox3;
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
16/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 16
private: System::Windows::Forms::ListBox^ listBox1;private: System::Windows::Forms::ListBox^ listBox2;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::Button^ button5;private: System::Windows::Forms::Button^ button6;private: System::Windows::Forms::Button^ button7;private: System::Windows::Forms::TextBox^ textBox4;private: System::Windows::Forms::TextBox^ textBox5;private: System::Windows::Forms::TextBox^ textBox6;
/// System::ComponentModel::Container ^components;
#pragmaregion 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 = (gcnewSystem::Windows::Forms::Label());
this->label2 = (gcnewSystem::Windows::Forms::Label());
this->label3 = (gcnewSystem::Windows::Forms::Label());
this->label4 = (gcnewSystem::Windows::Forms::Label());
this->textBox1 = (gcnew
System::Windows::Forms::TextBox());this->textBox2 = (gcnewSystem::Windows::Forms::TextBox());
this->textBox3 = (gcnewSystem::Windows::Forms::TextBox());
this->listBox1 = (gcnewSystem::Windows::Forms::ListBox());
this->listBox2 = (gcnewSystem::Windows::Forms::ListBox());
this->button1 = (gcnewSystem::Windows::Forms::Button());
this->button2 = (gcnewSystem::Windows::Forms::Button());
this->button3 = (gcnewSystem::Windows::Forms::Button());
this->button4 = (gcnewSystem::Windows::Forms::Button());
this->button5 = (gcnewSystem::Windows::Forms::Button());
this->button6 = (gcnewSystem::Windows::Forms::Button());
this->button7 = (gcnewSystem::Windows::Forms::Button());
this->textBox4 = (gcnewSystem::Windows::Forms::TextBox());
this->textBox5 = (gcnewSystem::Windows::Forms::TextBox());
this->textBox6 = (gcnewSystem::Windows::Forms::TextBox());
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
17/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 17
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(222,
23);this->label1->Name = L"label1";this->label1->Size = System::Drawing::Size(151, 20);this->label1->TabIndex = 0;this->label1->Text = L"ORDENAMIENTO";//// label2//
this->label2->AutoSize = true;this->label2->Location = System::Drawing::Point(42,85);
this->label2->Name = L"label2";this->label2->Size = System::Drawing::Size(61, 13);this->label2->TabIndex = 1;this->label2->Text = L"NOMBRES";//// label3//this->label3->AutoSize = true;this->label3->Location = System::Drawing::Point(41,
126);
this->label3->Name = L"label3";this->label3->Size = System::Drawing::Size(66, 13);this->label3->TabIndex = 2;this->label3->Text = L"APELLIDOS";//// label4//this->label4->AutoSize = true;this->label4->Location = System::Drawing::Point(42,
167);this->label4->Name = L"label4";this->label4->Size = System::Drawing::Size(44, 13);this->label4->TabIndex = 3;this->label4->Text = L"NOTAS";//// textBox1//this->textBox1->Location =
System::Drawing::Point(113, 82);this->textBox1->Name = L"textBox1";this->textBox1->Size = System::Drawing::Size(100,
20);this->textBox1->TabIndex = 4;//// textBox2//this->textBox2->Location =
System::Drawing::Point(113, 126);this->textBox2->Name = L"textBox2";
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
18/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 18
this->textBox2->Size = System::Drawing::Size(100,20);
this->textBox2->TabIndex = 5;//// textBox3//
this->textBox3->Location =System::Drawing::Point(113, 167);this->textBox3->Name = L"textBox3";this->textBox3->Size = System::Drawing::Size(100,
20);this->textBox3->TabIndex = 6;//// listBox1//this->listBox1->FormattingEnabled = true;this->listBox1->Location = System::Drawing::Point(45,
249);this->listBox1->Name = L"listBox1";
this->listBox1->Size = System::Drawing::Size(120,121);this->listBox1->TabIndex = 7;//// listBox2//this->listBox2->FormattingEnabled = true;this->listBox2->Location =
System::Drawing::Point(184, 249);this->listBox2->Name = L"listBox2";this->listBox2->Size = System::Drawing::Size(120,
121);this->listBox2->TabIndex = 8;
//// button1//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(253,
68);this->button1->Name = L"button1";this->button1->Size = System::Drawing::Size(103, 39);this->button1->TabIndex = 9;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(253,
126);this->button2->Name = L"button2";this->button2->Size = System::Drawing::Size(103, 38);
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
19/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 19
this->button2->TabIndex = 10;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", 9.75F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,
static_cast(0)));this->button3->Location = System::Drawing::Point(253,
186);this->button3->Name = L"button3";this->button3->Size = System::Drawing::Size(103, 38);this->button3->TabIndex = 11;this->button3->Text = L"SALIR";
this->button3->UseVisualStyleBackColor = true;this->button3->Click += gcnewSystem::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(338,
249);
this->button4->Name = L"button4";this->button4->Size = System::Drawing::Size(91, 30);this->button4->TabIndex = 12;this->button4->Text = L"ORDENAR";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(0)));this->button5->Location = System::Drawing::Point(338,
295);this->button5->Name = L"button5";this->button5->Size = System::Drawing::Size(91, 31);this->button5->TabIndex = 13;this->button5->Text = L"PROMEDIO";this->button5->UseVisualStyleBackColor = true;this->button5->Click += gcnew
System::EventHandler(this, &Form1::button5_Click);//// button6//this->button6->Font = (gcnew
System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
20/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 20
System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,
static_cast(0)));this->button6->Location = System::Drawing::Point(338,
341);this->button6->Name = L"button6";
this->button6->Size = System::Drawing::Size(91, 33);this->button6->TabIndex = 14;this->button6->Text = L"MAXIMO";this->button6->UseVisualStyleBackColor = true;this->button6->Click += gcnew
System::EventHandler(this, &Form1::button6_Click);//// button7//this->button7->Font = (gcnew
System::Drawing::Font(L"Microsoft Sans Serif", 8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,
static_cast(0)));this->button7->Location = System::Drawing::Point(338,390);
this->button7->Name = L"button7";this->button7->Size = System::Drawing::Size(91, 35);this->button7->TabIndex = 15;this->button7->Text = L"MINIMO";this->button7->UseVisualStyleBackColor = true;this->button7->Click += gcnew
System::EventHandler(this, &Form1::button7_Click);//// textBox4//
this->textBox4->Location =System::Drawing::Point(439, 301);this->textBox4->Name = L"textBox4";this->textBox4->Size = System::Drawing::Size(100,
20);this->textBox4->TabIndex = 16;//// textBox5//this->textBox5->Location =
System::Drawing::Point(439, 348);this->textBox5->Name = L"textBox5";this->textBox5->Size = System::Drawing::Size(100,
20);this->textBox5->TabIndex = 17;//// textBox6//this->textBox6->Location =
System::Drawing::Point(439, 398);this->textBox6->Name = L"textBox6";this->textBox6->Size = System::Drawing::Size(100,
20);this->textBox6->TabIndex = 18;//// Form1//this->AutoScaleDimensions = System::Drawing::SizeF(6,
13);
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
21/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 21
this->AutoScaleMode =System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(573, 461);this->Controls->Add(this->textBox6);this->Controls->Add(this->textBox5);this->Controls->Add(this->textBox4);
this->Controls->Add(this->button7);this->Controls->Add(this->button6);this->Controls->Add(this->button5);this->Controls->Add(this->button4);this->Controls->Add(this->button3);this->Controls->Add(this->button2);this->Controls->Add(this->button1);this->Controls->Add(this->listBox2);this->Controls->Add(this->listBox1);this->Controls->Add(this->textBox3);this->Controls->Add(this->textBox2);this->Controls->Add(this->textBox1);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"ORDENAMIENTO DE VECTORES";this->Load += gcnew System::EventHandler(this,
&Form1::Form1_Load);this->ResumeLayout(false);this->PerformLayout();
}
private: System::Void button1_Click(System::Object^ sender,System::EventArgs^ e) {numero[x]=Int32::Parse(textBox3->Text);x++;listBox1->Items->Add((x)+") "+textBox3->Text);textBox3->Text="";textBox3->Focus();if(x==4){button1->Enabled=false;}
}private: System::Void button4_Click(System::Object^ sender,System::EventArgs^ e) {
int temp,max=4,j;for(int i=1;i=0 && numero[j]>temp ;j--){numero[j+1]=numero[j];}numero[j+1]=temp;}for(int x=0;xItems->Add((x+1)+") "+numero[x]);}}
private: System::Void button5_Click(System::Object^ sender,System::EventArgs^ e) {
int i,s=0,p=0;for(i=0;i
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
22/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION Pgina 22
s+=numero[i];}p=s/4;textBox4->Text=(""+p);
}private: System::Void button2_Click(System::Object^ sender,
System::EventArgs^ e) {listBox1->Items->Clear();listBox2->Items->Clear();textBox1->Text="";textBox2->Text="";textBox3->Text="";textBox4->Text="";textBox5->Text="";textBox6->Text="";textBox3->Focus();button1->Enabled=true;x=0;
}
private: System::Void button6_Click(System::Object^ sender,System::EventArgs^ e) {int maximo=numero[0],i;for(i=0;imaximo){maximo=numero[i];}textBox5->Text=(""+maximo);}
}private: System::Void button7_Click(System::Object^ sender,System::EventArgs^ e) {
int minimo=numero[0],i;
for(i=0;i
7/31/2019 APLICACION DE ORDENAMIENTO DE VECTORES EN C++
23/23
ESTRUCTURA DE INFORMACION
ESTRUCTURA DE INFORMACION P i 23