datastructures

datastructures

Tuesday, May 1, 2007

Structures, Int, Char, String types on C++ 2005

Clic here to download the program.
Hacer clic aquí para descargar el programa.

Working on Visual C++ 2005 on a Windows Forms Applicacion:
Trabajando en Visual C++ 2005 en una Aplicación de Windows Forms:

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

Personalized structure/Estructura personalizada

//We create the structure. Se crea la estructura.
struct estructura{
int unidadesvalorativas;
char nombredelamateria[50];
char nombredelalumno[50];
char nombredeldocente[50];
int ciclo;
int ano;
double notafinal;
int asistenciafinal;
int matricula;
};
estructura a, b;//We declare variables "a" and "b" from type "estructura", which is a personalized class or structure created right above. Se deblaran las variables "a" y "b" del tipo "estructura", que es una clase (class) o estructura (structure) personalizada que se acaba de crear anteriormente.

Code for button1/Código para el button1

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
//This For is to fill with blank spaces all of the values in the Char arrays so that they don't save values from former processes. Con este For se llenan de espacios en blanco todos los valores de los arreglos Char para que no queden valores de procesos anteriores.
for(int i=0;i<50;i++){
a.nombredelamateria[i]=' ';
a.nombredelalumno[i]=' ';
a.nombredeldocente[i]=' ';
}
//Introduce values to the structure from values introduces by the user on the textBox spaces. Introduce valores a la estructura desde los valores introducidos por el usuario en los textBox.
a.unidadesvalorativas=System::Convert::ToInt32(textBox1->Text);
for(int i=0;i<textBox2->Text->Length;i++)
a.nombredelamateria[i] = textBox2->Text[i];
for(int i=0;i
a.nombredelalumno[i]=textBox3->Text[i];
for(int i=0;i<textBox4->Text->Length;i++)
a.nombredeldocente[i]=textBox4->Text[i];
a.ciclo=System::Convert::ToInt32(textBox5->Text);
//This line is not inside our "for" cycle anymore. Esta línea ya no está dentro del ciclo "for".
a.ano=System::Convert::ToInt32(textBox6->Text);
a.notafinal=System::Convert::ToDouble(textBox7->Text);
a.asistenciafinal=System::Convert::ToInt32(textBox8->Text);
a.matricula=System::Convert::ToInt32(textBox9->Text);
//All what is in a structure is sent to b structure. Todo lo que hay en la estructura a lo manda a otra estructura llamada b.
b=a;
}

Code for button2/Código para el button2

private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
//It takes values from the structure to print them out on textBox spaces. Toma valores de la estructura y los imprime en los textBox.
textBox10->Text=String::Format("{0}",b.unidadesvalorativas);
textBox11->Text="";
for (int i = 0 ; i< 50; i++)
textBox11->Text += Char::ToString(b.nombredelamateria[i]);
textBox12->Text="";
//This line is not inside our "for" cycle anymore. Esta línea ya no está dentro del ciclo "for".
for (int i = 0 ; i< 50; i++)
textBox12->Text += Char::ToString(b.nombredelalumno[i]);
textBox13->Text="";
//This line is not inside our "for" cycle anymore. Esta línea ya no está dentro del ciclo "for".
for (int i = 0 ; i< 50; i++)
textBox13->Text += Char::ToString(b.nombredeldocente[i]);
textBox14->Text=String::Format("{0}",b.ciclo);
//This line is not inside our "for" cycle anymore. Esta línea ya no está dentro del ciclo "for".
textBox15->Text=String::Format("{0}",b.ano);
textBox16->Text=String::Format("{0}",b.notafinal);
textBox17->Text=String::Format("{0}",b.asistenciafinal);
textBox18->Text=String::Format("{0}",b.matricula);
}

Jaime Montoya
webmaster@jaimemontoya.com
www.jaimemontoya.com

7 comments:

Anonymous said...

Interesting to know.

Anonymous said...

you love this? RzzyKxMr [URL=http://www.cheapguccireplica.tumblr.com/]gucci online store[/URL] online shopping AVWzZtGc [URL=http://www.cheapguccireplica.tumblr.com/ ] http://www.cheapguccireplica.tumblr.com/ [/URL]

Anonymous said...

look at wFxJukkx [URL=http://www.cheapdesigner--handbags.weebly.com/]knock off designer handbags[/URL] to your friends DOTEfjcT [URL=http://www.cheapdesigner--handbags.weebly.com/ ] http://www.cheapdesigner--handbags.weebly.com/ [/URL]

Anonymous said...

buy SxMyVznG [URL=http://www.cheapdesigner--handbags.weebly.com/]designer outlet[/URL] , just clicks away qmrUCcGL [URL=http://www.cheapdesigner--handbags.weebly.com/ ] http://www.cheapdesigner--handbags.weebly.com/ [/URL]

Anonymous said...

I pay a visit each day a few web sites and websites to read content, except this blog offers feature based posts.


Here is my web-site :: Birburim.Com

Anonymous said...

I beliеvе that is onе of the so muсh іmpοrtant info for me.
Аnԁ i am glad reading your article. But want
to rеmark on feω bаsic things, The site taste іs іdeal, the articles іѕ in point of fact
excellent : D. Exсellent job, cheers

my webpage - crear facebook gratis

Anonymous said...

My brother suggested I would possibly like this blog.
He used to be totally right. This submit actually made my day.
You cann't believe just how a lot time I had spent for this info! Thanks!

Visit my web page; hotmail account