Thursday, January 4, 2007

Hamburg Blaupunkt Bluetooth



computer Hello

I hope you have received a good 2007

I therefore hope that all your wishes come true ... Thanks for

visit again.

This month we will talk about programming.

Our topic is: Control Structures.

Eyes to the text!

(supposedly to work ... lol)

Primera mente, el la programación, se necesitan estrategias para resolver un problema, tan simple como llevar el peso de los pasajeros de un avión, como uno tan difícil como llevar la base de datos de un ministerio…

Es por eso que “Las estructuras de control” son las herramientas que nos ayudan a pensar en grande sin ninguna limitación. Imagina de no existieran, la programación perdería seguidores.

Ha de mencionarse que hay ramificaciones de estas structures and that they use variables (to remember, expect there to figure this out):

å repetitive structure.

å Alternative Structures.

let's define ...

å repetitive structures: those structures that allow us to repeat a number of statements a certain number of times.

å Alternative Structures: These are the structures that give us the option of choosing a path, depending on the choice we have to evaluate an expression (the expression that I do not mean to mathematics, but, to such an assessment if this is this or that came to, etc ... I explained?)

Rating:

å repetitive structures are classified into 3. Structure, For, While and Until.

å Alternative structures are classified into 3. If-then structure (conditional simple), if-then structure "Otherwise (conditional double) and Case Structure.

repetitive structure

å Structure To: we use when we know twins Sometimes they will repeat the instructions or we can say, a known number of times.

å While Structure: This structure works by evaluating an option. If this is true, it enters the repeat cycle, otherwise continue with the rest of the code. Used when we do not know how many times will be repeated.

å Until Structure: As with the other, use an expression to enter repetitive cycle. If this is false, the goes, and otherwise, continue execution of code. Used when we know that will be repeated at least once or every time I do not know how many times will be repeated.

worth noting two things: 1. That is very important to know that the structures while and until, if they work with an expression to enter the cycle, they need, by force, an expression (in code) to modify the variable expression (before entering) . 2. The variables used in the expressions of the three structures must be BY FORCE, whole, since there is no cycle and means to say that the variable is floating. Let us look at algorithm.

Structure For .

Format:

For (variable1 = 0; variable1> = number or other variable, variable1 = variable1 +1 [or two or three])

{

Code to perform;

}

Otherwise:

integer x;

For (x = 0, x> 2 [you can use the same depending on your logic], x = x +1 [is valid: x + +])

{

code to be executed;

}

* when it comes here, he returns to evaluate the option to see if it is true or false, that for the other two structures.

Explanation: When you first enter, question: x> 2 (0> 2), why zero?, Since x is 0, this is true, he enters. Complete and return question: x> 2 (in this case is: 1> 2, since entering the x increases by one and so on, make the condition true (x> 2).

While structure.

Format:

While (expression)

{

code to be executed;

expression that modifies the expression mother

}

* When I came here to check the expression returns.

Example:

whole and,

While (and <5)

{

Print ("I @");

y = y +1; (expression changes, "explained to me with this?)

}

* when it comes here, go check if the expression is true.

Explanation: states "and" as a whole and takes the value 0 by default. When it comes to the ring, asks, and <5 y="y">

"It counts from 0 to the front. The 0 count, but if you want, you can say it starts at 1. If you do a screen test with the two forms, given the two, 5 reps (of 0 to 4 and 1 to 5)

Am I explaining?

Structure Until .

Format:

Until (expression)

{

code to be executed;

Expression mother adjust to the expression.

}

* When I came here to check the expression returns.

Example:

integer k;

Until (k> = 2)

{

Print ("¿¿¿'re learning ?????@");

k + +; (this is valid and adjust to the "k "to use the expression)

}

* when it comes here, go check if the expression is false.

The explanation is the same, only the exopresión must be false to enter.

Alternative Structures

å if-then structure ( simple conditional) is used when, in evaluating an expression, if true, log on to execute a single instruction code.

Å

-if-then structure Otherwise (conditional double): we use when evaluating a choice, if this is true, executes a series of instructions, to be not true, execute the other code instructions.

å Case Structure: Used when you know that more than two options chosen. We think it would be like a menu, in fact, is that the structure is conducive to menus. Auque, as logic is king, I also make a menu if-then structure or if-then-otherwise. These structures would be embedded (one inside the other). This structure works with a single variable that will be full. Depending on the value of, will come looking for conquierde case with the value, when found, will execute the code that is written in it. It is important to note that inside the code should be the sentences " break; " which tells the structure, it's over, and that should come, to continue with the rest of the code.

Let formats.

if-then structure .

Format:

Yes (condition)

{

Code run;

}

Example:

Yes (> 5)

{

Print ("a has a value greater than 5, so it went, and it is true");

}

if-then structure-In Otherwise .

Format:

Yes (condition)

{

Code to execute if the condition is true;

}

Otherwise

{

Code to execute if the condition is not met;

}

Example:

Yes ( < 3)

{

Print ("a has a value less than 3" )

}

Otherwise

{

Print ("a has a value greater than 3" )

}

If not satisfied, go to the fake.

Case Structure.

Format:

Case (variable)

{

Case 1

{

instruction code executed if the condition is correct;

}

Case 2

{

instruction code executed if the condition is correct;

}

Case 3

{

instruction code executed if the condition is correct;

}

And so on ...

} * this is the key to closing the case body

Example:

Case (a)

{

Case 1

{

Print ("Are you learning? ");

break;

}

Case 2

{

Print ("If you do not understand, ask me !!!");

break;

}

} * this is the key to closing the case body.

If a is 1, in and done what is in a block, if two, which is in block two.

Hope you liked it.

If you do not understand, ask me with confidence ...

Best regards and see you next month.

Goodbye!