Last active
January 17, 2021 06:43
-
-
Save Aldhanekaa/9f3ae69d9abddf8597ddcb1ae1f6acc8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdlib.h> | |
using namespace std; | |
// g++ bmi.cpp -o bmi && ./bmi | |
int main() | |
{ | |
// bmi = weight / height ** 2 | |
float weight, height, bmi; | |
char confirm = 'N'; | |
char b = 'N'; | |
while (confirm == 'N' || confirm == 'n' || b == 'Y') | |
{ | |
if (weight && height) | |
system("clear"); | |
cout << "may I know your height please? "; | |
cin >> height; | |
cout << "may I know your weight please? "; | |
cin >> weight; | |
system("clear"); | |
cout << "height: " << height << endl; | |
cout << "weight: " << weight << endl; | |
cout << "\nAre those your informations? [Y/N] \n"; | |
cout << "==================\n"; | |
cin >> confirm; | |
} | |
system("clear"); | |
bmi = weight / (height * height); | |
cout << "Your BMI is: " << bmi << endl; | |
cout << "wanna try again? [Y/N] \n"; | |
cin >> b; | |
if (b == 'Y') | |
{ | |
main(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error has solved