Conversor de pulgadas a 7 unidades distintas [ESP-ENG] | C++

avatar

Covercito papah.jpg

¡Saludos! Hoy traigo un conversor de pulgadas a KM,HM,DM,m,cm,dm,mm. Este programa es un poco más complicado que los que traigo de costumbre, pues combino el bucle do-while con la sentencia switch, es decir un selector con un bucle repetitivo, esto para que se repita el selector siempre y cuando el usuario elija una opción diferente a la que ha sido asignada para salir, en este caso el '9'.

Por tanto usé dos variables, opc y pulg. La primera para asignarla al switch (selector) y que según recoja la entrada por teclado con el getch(), se active alguna de las opciones programadas según los casos 1-9. Por eso es del tipo char. Por supuesto, antes de esto recibe la medida en pulgadas y la guarda en la variable del tipo double "pulg", para luego, según sea el caso elegido, lo convierte a alguna de las medidas antes mencionadas y luego lo muestra en pantalla.

Greetings! Today I bring a converter of inches to KM,HM,DM,m,cm,dm,mm. This program is a little more complicated than the ones I usually bring, because I combine the do-while loop with the switch statement, that is to say a selector with a repetitive loop, this so that the selector is repeated as long as the user chooses an option different from the one that has been assigned to exit, in this case the '9'.

Therefore I used two variables, opc and in. The first one to assign it to the switch (selector) and that according to pick up the input by keyboard with the getch(), it activates some of the programmed options according to the cases 1-9. That is why it is of char type. Of course, before this, it receives the measurement in inches and stores it in the variable of type double "in", and then, depending on the chosen case, it converts it to one of the measurements mentioned above and then displays it on the screen.

image.png

image.png

image.png

Programación c++.png

La opción 8 incluye todas las conversiones juntas, de modo que no es individual solamente. Este programa constituye una mejora a un programa que me compartió un compañero de Ingeniería en Computación hace tiempo. Al final dejaré su modelo, para que puedan compararlo con la mejora.

Las librerías usadas: iostream para la entrada y salida de datos, conio.h para la sentencia que pausa el programa para evitar el cierre repentino y windows.h para el limpiador de pantalla o system("cls").

Option 8 includes all conversions together, so it is not individual only. This program is an improvement to a program that a fellow Computer Engineering student shared with me some time ago. At the end I will leave his model, so you can compare it with the improvement.

The libraries used: iostream for data input and output, conio.h for the statement that pauses the program to avoid sudden shutdown and windows.h for the screen cleaner or system("cls").

image.png

image.png

image.png


Acá les dejo una captura de uso según la opción elegida, está bastante buena la mejora a mi parecer, aunque me parece que sería aún mejora añadir más unidades, quizás en un futuro programa.

Here I leave a screenshot of use according to the chosen option, the improvement is quite good in my opinion, although it seems to me that it would be even better to add more units, perhaps in a future program.

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

Programación c++.png

¡Y bueno... Eso es todo por hoy! Espero que les haya gustado este programa para convertir de pulgadas a todas esas unidades que mencioné, si tienes algún consejo, recomendación, crítica constructiva, anécdota o algo productivo que agregar será bienvenido, saludos y bendiciones, Viva Cristo Rey.

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! I hope you liked this program to convert from inches to all those units I mentioned, if you have any advice, recommendation, constructive criticism, anecdote or something productive to add will be welcome, greetings and blessings, Viva Cristo Rey.

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


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 [ESP-ENG] C++10

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
4 comments
avatar

Congratulations @gabrielr29! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

You made more than 700 comments.
Your next target is to reach 800 comments.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

0
0
0.000
avatar

Como lo comenté en el programa: no soy muy conocedora del tema pero de verdad impresionas con cada post que presentas... De verdad admiro la capacidad de conocimientos que tienes!!

0
0
0.000
avatar

¡Graciaaaas! Sus palabras me impulsan a seguir adelante con mis estudios

0
0
0.000
avatar

Ese es el deber ser...que sigas con esa motivación... Tienes mi apoyo

0
0
0.000