This Code Works Fine Copy This Code to your C++ Editor And Run It
For eg:-
If You Type Your Height as 156
Age as 13
And Gender m
Then It Will Display 100
While the Orginal Answer is around 176.
PLS HELP ME
#include "STDAFX.H"
#include "iostream"
#include "string"
#include "iomanip"
int main()
{
using namespace std;
int x;
cout << "Enter Your Height: ";
cin >> x;
std::string g;
cout <<"Enter Your Gender (M/F)";
std::cin >> g;
int y;
cout << "Enter Your Age (Must Be >=8)";
cin >> y;
if (g == "m" && y == 8){
cout << "Your Max Height Will Be Around " << (x/72)*100;
}
else if (g == "f" && y == 8)
{
cout << "Your Max Height Will Be Around " << (x/77)*100;
}
else if (g == "m" && y == 9)
{
cout << "Your Max Height Will Be Around " << (x/75)*100;
}
else if (g == "f" && y == 9)
{
cout << "Your Max Height Will Be Around " << (x/81)*100;
}
else if (g == "m" && y == 10)
{
cout << "Your Max Height Will Be Around " << (x/78)*100;
}
else if (g == "f" && y == 10)
{
cout << "Your Max Height Will Be Around " << (x/84)*100;
}
else if (g == "m" && y == 11)
{
cout << "Your Max Height Will Be Around " << (x/81)*100;
}
else if (g == "f" && y == 11)
{
cout << "Your Max Height Will Be Around " << (x/88)*100;
}
else if (g == "m" && y ==12)
{
cout << "Your Max Height Will Be Around " << (x/84)*100;
}
else if (g == "f" && y == 12)
{
cout << "Your Max Height Will Be Around " << x/91)*100;
}
else if (g == "m" && y == 13)
{
cout << "Your Max Height Will Be Around " << (x/88)*100;
}
else if (g == "f" && y == 13)
{
cout << "Your Max Height Will Be Around " << (x/95)*100;
}
else if (g == "m" && y ==14)
{
cout << "Your Max Height Will Be Around " << (x/92)*100;
}
else if (g == "f" && y == 14)
{
cout << "Your Max Height Will Be Around " << (x/98)*100;
}
else if (g == "m" && y ==15)
{
cout << "Your Max Height Will Be Around " << (x/95)*100;
}
else if (g == "f" && y == 15)
{
cout << "Your Max Height Will Be Around " << (x/99)*100;
}
else if (g == "m" && y == 16)
{
cout << "Your Max Height Will Be Around " << (x/98)*100;
}
else if (g == "f" && y == 16)
{
cout << "Your Max Height Will Be Around " << (x/99.5)*100;
}
else if (g == "m" && y == 17)
{
cout << "Your Max Height Will Be Around " << (x/99)*100;
}
else if (g == "f" && y >= 17)
{
cout << "You Have Reached Your Max Height";
}
else if (g == "m" && y >= 18)
{
cout << "You Have Reached Your Max Height";
}
}
You're doing integer division. Your results are going to be truncated.
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/