Calculadora de índice de masa corporal [ESP-ENG] | C++

avatar

ccc.jpg

¡Buenos días! Acá les traigo más programación, esta vez se trata de una calculadora de "Índice de Masa Corporal". El enunciado es: "Realice un programa que reciba el tamaño de un individuo en centimetros y su peso en kilogramos y calcule el índice de masa corporal. IMC=((peso en kilogramos )/(estatura en metros al cuadrado) la clasificación de la Organización mundial de la salud (Debajo estará en un cuadro).

Para empezar las librerías que usé son las de costumbre, iostream para la entrada y salida, windows.h para poder usar "System("pause) y System("cls")" y conio.h para "getch". Las variables usadas son "altura", "peso" e "indice". Las primeras dos para almacenar los datos recibidos y la tercera para almacenar el IMC calculado.

Una vez los recibe y lo calcula empieza a verificar por medio de una serie de "if elses" a qué rango de la clasificación pertenece el índice calculado y según sea el caso envía un mensaje informándolo. Todo esto dentro de un bucle, pues quise hacerlo de tal modo que no se cierre una vez halla terminado la primera ejecución.

Good morning! Here I bring you more programming, this time it is a "Body Mass Index" calculator. The statement is: "Make a program that receives the size of an individual in centimeters and weight in kilograms and calculates the body mass index. BMI=((weight in kilograms)/(height in meters squared) the classification of the World Health Organization (Below will be in a table).

To start with the libraries I used are the usual ones, iostream for input and output, windows.h to be able to use "System("pause) and System("cls")" and conio.h for "getch". The variables used are "height", "weight" and "index". The first two to store the received data and the third one to store the calculated BMI.

Once it receives and calculates it, it starts to verify by means of a series of "if elses" to which range of the classification the calculated index belongs and, depending on the case, it sends a message informing it. All this inside a loop, because I wanted to do it in such a way that it does not close once it has finished the first execution.

image.png

image.png

image.png

Programación c++.png

Una vez termina de dar el mensaje con el rango en el que se encuentra el indice calculado pasa a otro "do while" que dentro tiene un "switch" es decir un selector, el bucle es para evitar que se salga del switch por ingresar una tecla que no está entre las dos opciones (y/n) y en cada caso es para continuar con el bucle principal o terminarlo, por medio de cambiar el estado de "exit", una variable booleana declarada al principio para la condición del "while" principal.

Once it finishes giving the message with the range in which the calculated index is located, it passes to another "do while" that inside has a "switch" that is to say a selector, the loop is to avoid leaving the switch by entering a key that is not between the two options (and/n) and in each case it is to continue with the main loop or to finish it, by changing the state of "exit", a boolean variable declared at the beginning for the condition of the main "while".


image.png

Programación c++.png

image.png

image.png

¡Y bueno... Eso es todo por hoy! Espero que esta calculadora de IMC resulte útil para alguno de ustedes. Cabe recordar que este programa no verifica la entrada por teclado, es decir, no comprueba si la entrada es texto, signos o números, por lo que ingresar un dato que no corresponda a los que se usan para trabajar en este caso, provocaría errores. También hay un pequeño error porque coloqué "está" en algunos mensajes por lo que al ejecutar suele aparecer ese carácter acentuado como un carácter distinto por la naturaleza de C++.

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 this BMI calculator will be useful for some of you. It is worth remembering that this program does not check the keyboard input, that is, it does not check if the input is text, signs or numbers, so entering a data that does not correspond to those used to work in this case, would cause errors. There is also a small error because I put "is" in some messages so that when executing usually appears that character accented as a different character by the nature of C++.

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 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

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

Saludos, me agreado tu post, muy interesante aplicacion, veo que tienes una idea clara de la programacion, genial desarrollo :)

0
0
0.000