[ESP-ENG] Aprendiendo lenguaje de programación C++ parte 1 / Learning C++ programming language part 1

Words
1041
Reading
5 min
Listen
Play
4y

Polish_20220927_165100980.png

Hola muy buenas a todos amigos, hoy les quiero traer algo nuevo, me demore porque me quede pensando en que traer y se me ocurrió traerles mi tarea de algoritmo, les cuento, soy estudiante de universidad y estoy estudiando informática, por ahora no es tan dura la carrera, pero, mas adelante se va volviendo mas compleja, hoy les quiero traer la tarea que por ahora es bastante básico lo que me han dado.

Sin título.jpg

Primero que nada, colocamos como comentario en línea para que va a ser utilizado el programa en cuestión, este por lo menos será utilizado para que el numero que le ingreses, lo lea y te muestre en pantalla el resultado multiplicado por 25. Es algo totalmente inútil a menos que necesites sacar algún tipo de cuenta y solo cambies el 25 y coloques el numero que necesites que se multiplique esa cantidad.

2.jpg

Empezamos colocando el primordial #include que sirve para declarar la lectura y escritura.

3.jpg

Luego de eso colocamos “using namespace std;” esto lo colocamos para no tener que escribir “std::cout” en cada línea, si no que solo tendremos que escribir el “cout”

4.jpg

Acá empezamos con lo que vendría siendo el inicio de todo, escribir “int main(){“ indica el punto de partida donde comenzara la magia de programar.

5.jpg

Luego mas abajo, volvemos a colocar otro “int” pero, esta vez con un “n;” este carácter representara el numero que vamos a ingresar nosotros como usuario para que el algoritmo pueda leerlo.

6.jpg

Escribimos lo primero, lo principal “ingrese el numero” va a aparecer escrito en pantalla una vez iniciemos el programa, para terminar cada línea, tenemos que colocar un separador de líneas, y para eso tendremos que escribir “endl;” o “/n” ambos sirven como separadores de línea, sirven para que todo no te quede pegado.

7.jpg

Como escribimos primero en pantalla, ahora leeremos el numero ingresado como respuesta, para ello utilizaremos “cin>>n;” declarando que queremos leer el numero escrito en la ventana.

8.jpg

Mas abajo colocaremos el “cout” y después “Resultado:” para que el numero del resultado se multiplique por 25, tendremos que colocar “25n” seguido de un “endl;” y el comando quedaría mas o menos así “cout<<”Resultado:”<<25n<<endl;”

9.jpg

Para finalizar, escribiremos “return 0;” que sería volver a empezar, ya con el programa terminado, tenemos que probarlo para verificar que funcione.

10.jpg

Como podemos observar, luego de compilarlo y ejecutarlo, nos aparecerá una ventana de Windows, donde lo primero que aparecerá es “Ingrese el numero” al escribir nosotros un número, el que se les ocurra en el momento, este será leído, multiplicado por 25 y se muestra en pantalla nuevamente.

11.jpg

Tal que así, es un programa bastante simple, no lleva mucho tiempo hacerlo, pero, para alguien totalmente nuevo en los algoritmos, esto tiene sus complejidades, ejemplo: Que te pongan a hacer este mismo algoritmo, sin siquiera saber que hacer para que se multiplique por 25. Sería una locura.

Bueno amigos, hasta aquí la publicación de hoy, espero que les haya gustado. Mitsu se despide de ustedes enviándoles un fuerte abrazo.

1.png

2.png

3.png

Hello very good to all friends, today I want to bring you something new, I was late because I was thinking about what to bring and it occurred to me to bring you my algorithm task, I tell you, I am a university student and I am studying computer science, for now it is not so hard, but, later it will become more complex, today I want to bring you the simplest task that I have received of algorithmic, I hope you like it.

01.jpg

First of all, we put as a comment in line what the program in question is going to be used for, it will at least be used to read the number you enter and show you on the screen the result multiplied by 25. It is totally useless unless you need to get some kind of account and just change the 25 and put the number you need to multiply that amount.

'2.jpg

We start by placing the primordial "#include" which is used to declare the read and write.

03.jpg

After that we put "using namespace std;" we put this so we don't have to write "std::cout" in each line, but we only have to write the "cout".

04.jpg

Here we start with what would be the beginning of everything, writing "int main(){" indicates the starting point where the magic of programming will begin.

05.jpg

Then further down, we place another "int" but, this time with an "n;" this character will represent the number that we as the user are going to enter so that the algorithm can read it.

06.jpg

We write the first thing, the main thing "enter the number" will appear written on the screen once we start the program, to finish each line, we have to place a line separator, and for that we will have to write "endl;" or "/n" both serve as line separators, they serve so that everything is not stuck together.

07.jpg

As we wrote first on the screen, now we will read the number entered as a response, for this we will use "cin>>n;" declaring that we want to read the number written in the window.

08.jpg

Further down we will place the "cout" and then "Result:" so that the number of the result is multiplied by 25, we will have to place "25n" followed by an "endl;" and the command would look more or less like this "cout<<<"Result:"<<25n<<<endl;"

09.jpg

To finish, we will write "return 0;" which would be to start over, now with the program finished, we have to test it to verify that it works.

010.jpg

As we can see, after compiling and executing it, a Windows window will appear, where the first thing that will appear is "Enter the number" when we write a number, the one that comes to mind at the moment, this will be read, multiplied by 25 and it will be shown on the screen again.

011.jpg

So, it is a fairly simple program, it does not take a lot of time to do it, but, for someone totally new to algorithms, this has its complexities, example: That they put you to do this same algorithm, without even knowing what to do to multiply by 25.

Well friends, so far today's publication, I hope you liked it. Mitsu says goodbye to you sending you a big hug.

4.png

[ESP-ENG] Aprendiendo lenguaje de programación C++ parte 1 / Learni... | Ecency