Monthly Archives: February 2015

luisgarcia11 2015-02-23 09:35:46

Basic output (printing) and input (text based) in C+ https://www.youtube.com/watch?v=9_petI21bGk&feature=youtu.be

On to functions

To complete this code, I had to watch Ken’s video a few times, to be sure what he did on the top with the functions, at the end I understood, so I recommend you watch the video as well, I’ll leave the link.

https://www.youtube.com/watch?v=aXQfo6c8wzs&feature=youtu.be

That’s the second part of the code, be sure to check the details. =)

#Mastery18 #TC1017

Nesting of conditional statements

Nesting of conditionales statements such as if´s, else´s or switch´s is a way to solve a problem using programming. As it´s name says is just nesting conditionals Here goes an image where you can see how it has to look like the nest of conditionals. Depending on which conditional you use it will be the way you have to use them. Remember that nesting conditional statements it´s used for making decisions while the programm is running and it´s required the well syntax. 

The conventions of programming are required and remember that every line that will “depend” from another has to be a little bit written to the right as you can see in the example code. Example:

if (The blog == Blog)

    cout << “Correct” << endl;

else 

      if (The blog != Blog)

          cout << “incorrect” << endl; 

#mastery18 #TC1017

We say that a conditional structure is nested when the branch of true or false in a conditional structure is another conditional structure. for example:

#mastery18 #TC1017

The flow chart is presented contains two conditional structures. The principal is a conditional composite structure and the second is a simple conditional structure and is contained by the false branch of the first structure.

It is common for even more complex nested conditional structures arise.

in c ++ have another format, we will see later in our wsq.

#mastery17 #TC1017

It’s called switch to a variable that takes only two values, which are identified with the “open / closed”, “true / false”, “on / off”, “start / stop”, “valid / invalid”, etc.

 

The switch is used to control and program flow for decision making. For its bipolar nature resemble Boolean variables, occurring many times that the switch is a boolean variable. However, not all switches are Boolean variables or all variables are boolean switches.

A switch normally be replaced by an evaluation of a variable. However, they are widely used because they avoid having to evaluate complex expressions and because they provide clarity for writing and reading programs.

#mastery09 #TC1017

Compilers reserve certain terms or keywords (keywords) for the syntactic language use, such as: asm, auto, break, case, char, do, for, etc. While these words are defined for ANSI C, different compilers extend this definition to other terms.

To create a variable in a particular place of a program first write the variable and then the identifier with which we name the variable, followed all a ‘;’. This is referred to define a variable. The general definition is:

 

For example:

 

int number; / * Create the variable number of type integer * /

char letter; / * Create the letter variable, character type * /

float a, b; / * Create two variables a and b, of floating point number * /

 

#Mastery01


#Mastery01

#Mastery01

Basicamente este es un b谩sico programa usando C++, llamado Hello World.

Saludos 馃槢

#Mastery17 #TC1017

Use switch as a conditional

Programming in C++ gives you a big list of conditionals that you may use to take decisions while the programm is running. One of those it´s called “switch”. As the if´s and elses the switch can be used as a conditional. First the switch has a particular way to use it. As you can see in the image the switch need a parameter to compare the given “message” and then take decisions between the bunch of posibilities. After that switch needs { } After all this the posibilities come and the way to write them are with a “case” before de posibility. Having the “case” means that there will be the first posibility. The posibiilty has to be inside ” ” to indicate itself as a posibility after that : are required. After having the posibility you can add whatever you can, a cout << ” ” << endl; or another conditional but you should have a break after whatever you do to close that posibility. At the last posibility is not required with a break cause at this point you will close the whole switch with correspond } . 

 

#Mastery12


#Mastery12

#Mastery12

void nombre.de.tu.funcion (){

condici贸n

}

Esta es la esctuctura de una funci贸n en C++ la cual se utilizan para que el uso constante de una operaci贸n espesifica, la cual en ves de escribirla un determinado de veces la funci贸n, solo se escribe una ves y solo se especifica en la funci贸n en el c贸digo las veces que se desea usar.

un ejemplo del uso de funciones en C++ esta en la photo de esta publicaci贸n.

Donde tambi茅n se puede encontrar una explicaci贸n clara del uso de funciones en C++ es en el libro: Downey, A. (1999). How to think like a computer scientist : C++ version. [S. l.]: SoHo Books.

#WS08 use of functions #TC1017


#WS08 use of functions #TC1017