Skip to content

Instantly share code, notes, and snippets.

@Aldhanekaa
Last active January 17, 2021 06:43
Show Gist options
  • Save Aldhanekaa/9f3ae69d9abddf8597ddcb1ae1f6acc8 to your computer and use it in GitHub Desktop.
Save Aldhanekaa/9f3ae69d9abddf8597ddcb1ae1f6acc8 to your computer and use it in GitHub Desktop.
#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();
}
}
@Aldhanekaa
Copy link
Author

Error has solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment