Graficando números en consola II (4-6) [ESP-ENG] | C++

C++.jpg

¡Buen día! Acá les traigo la segunda parte de "graficando números en consola", me ha tomado tiempo prepararla pero es que es un poco complicado explicar a detalle las condiciones. Antes de entrar en materia deberías pasarte por el post anterior para tener buen contexto de qué verás acá.

Good morning! Here I bring you the second part of "plotting numbers in console", it has taken me some time to prepare it but it is a little complicated to explain in detail the conditions. Before getting into the subject you should go through the previous post to have a good context of what you will see here.

Programación c++.png

Dado que las librerías ya fueron mostradas en la parte anterior, entremos a la función que describe el número cuatro (void four), los parámetros son iguales a los anteriores mencionados (x para el posicionamiento en los horizontales, y para el posicionamiento en los verticales, n para el tamaño (nxn).

Para la primera línea necesitamos una condición que involucre la mitad del tamaño (n/2), empezando desde 0, por tanto en los verticales quedaría i<n/2, es decir mientras que i sea menor a la mitad del tamaño ingresado por el usuario y j sea 0. Para la barra/línea inferior tomamos en cuenta que i sea igual a la mitad del tamaño ingresado y j se mantenga menor al tamaño ingresado. Para finalizar la condición de la barra de la derecha es j==n-1 que representaría el límite derecho. Recordando que el conteo inicia en 0 y por eso el "-1".

Habiendo visto el ejemplo del 4, nos encontramos con el 5 que lógicamente tiene más condiciones pues el número de líneas necesarias es superior. Sin embargo no es para tanto pues habiendo entendido el anterior, el patrón es mucho más fácil de seguir. i==0 y j<n para la línea superior, la siguiente condición es igual a la línea inferior al centro de nuestro 4 solo que en vez de usar "<n" se usó "<=n-1". Para la línea inferior usaríamos "i==n-1", para la línea izquierda que va hasta el centro repetimos la condición del cuatro "i<n/2 y j==0" y para la línea derecha que va desde el centro hasta la línea inferior "j==n-1 && i>=n/2 && i<n".

Since the libraries were already shown in the previous part, let's enter the function that describes the number four (void four), the parameters are the same as the previous ones mentioned (x for the positioning in the horizontals, y for the positioning in the verticals, n for the size (nxn).

For the first line we need a condition involving half the size (n/2), starting from 0, therefore in the verticals it would be i<n/2, i.e. as long as i is less than half the size entered by the user and j is 0. For the bottom bar/line we take into account that i is equal to half the size entered and j remains less than the size entered. Finally, the condition for the right bar is j==n-1 which would represent the right boundary. Recalling that the count starts at 0, hence the "-1".

Having seen the example of 4, we find ourselves with 5 which logically has more conditions because the number of lines needed is higher. However it is not so much because having understood the previous one, the pattern is much easier to follow. i==0 and j<n for the upper line, the following condition is the same as the line below the center of our 4 only that instead of using "<n" we used "<=n-1". For the bottom line we would use "i==n-1", for the left line going to the center we repeat the condition of the four "i<n/2 and j==0" and for the right line going from the center to the bottom line "j==n-1 && i>=n/2 && i<n".

image.png

image.png

image.png


Para el 6 solo tenemos que repetir gran parte de las condiciones del 5, solo que para la barra izquierda consideramos "j==0" y reducimos las que sobren.

Para terminar hay que considerar que el espacio entre números puede variar por lo que es bueno probar varias veces antes de decidir una distribución.

For 6 we only have to repeat most of the conditions of 5, only that for the left bar we consider "j==0" and reduce the remaining ones.

Finally we have to consider that the spacing between numbers can vary so it is good to try several times before deciding on a distribution.

image.png

image.png

image.png

image.png

Programación c++.png

¡Y bueno... Eso es todo por hoy! Ya solo falta una parte (7-9) para terminar con esta serie para aprender a graficar números. Podría seguir con las letras pero no hay prisa.

Si te interesa otro tutorial de programación acá te dejo los links a los que he realizado hasta ahora:

And well... That's all for today! There is only one part left (7-9) to finish with this series to learn how to graph numbers. I could go on with the letters but there is no hurry.

If you are interested in another programming tutorial here are the links to the ones I have done until now:


Nombre de la publicación / Name of the postLINK
Calculador de datos para un triángulo rectángulo en C++1
Concecionario de autos, ejercicio en JAVA2
Calculador de edad básico C++3
Inversor de números de tres cifras4
¿Cuántos números de 3 cifras existen cuya suma sea 10? - ¡Respondiendo a otro usuario! C++6
Calculadora simple, cifra menos significativa y portada simple C++7
¡Vistazo a BeatUDO! [ESP-ENG] JAVA9
Comprobar si un número de dos cifras es primo C++10
Conversor de pulgadas a 7 unidades distintas C++11
Comprobar si un número es capicúa (Máx 5 cifras) C++12
Comprobador de caracteres C++13
Calculadora de índice de masa corporal C++14
Calculadora de factoriales C++15
Conversor (Grados Celsius - Fahrenheit - Kelvin) C++16
Calculadora de longitud, diametro y área de una circunferencia C++17
Graficando números en consola (0-3) C++18

Programación c++.png

Puedes seguirme por acá si lo deseas:
You can follow me here if you want:

Diseño sin título.gif

Cuenta secundaria
(Dibujos, edición y juegos) | Secondary account (Drawings, editing and games)



0
0
0.000
1 comments