Indent your code properly. When you don't use code tags, the forum eats all the leading spaces, so I can't tell how you've indented your code. Proper indentation makes unmatched open/close brace errors obvious.
Instead of
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
int main()
{
int a = 5;
for(int i = 0; i < a; i++)
{
if(i % 2 == 0)
{
std::cout << i << " is even" << std::endl;
}
else
{
std::cout << i << " is odd" << std::endl;
}
}
}
say
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
int main()
{
int a = 5;
for(int i = 0; i < a; i++)
{
if(i % 2 == 0)
{
std::cout << i << " is even" << std::endl;
}
else
{
std::cout << i << " is odd" << std::endl;
}
}
}
Above - everything is nicely matched up. Now look at the code further down:
1 2 3 4 5 6 7 8 9 10 11 12 13
elseif (gendertype == 3)
{
if (weight < BMI_MIN) //Active Male is underweight
cout << "Weight Category: Underweight" << endl;
}
elseif (weight > BMI_MAX) //Active Male is overweight
{
cout << "Weight Category: Overweight" << endl;
}
else // Active Male is optimum weight
cout << "Weight Category: Optimum" << endl;
}
}
there, the open brace at line 2 matches the closing brace at line 5 - though it surely should not do - there is an open brace missing. There are a number of mismatches like that. You need to carefully go through and make sure they are in nice matched pairs.
There, the code should I think look more like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
elseif (gendertype == 3)
{
if (weight < BMI_MIN) //Active Male is underweight
{
cout << "Weight Category: Underweight" << endl;
}
elseif (weight > BMI_MAX) //Active Male is overweight
{
cout << "Weight Category: Overweight" << endl;
}
else // Active Male is optimum weight
{
cout << "Weight Category: Optimum" << endl;
}
}
Ok. I fixed it more thanks to you guys, but my last two errors are these.
Error 1 error C1075: end of file found before the left brace '{' at 'c:\users\hp pc\documents\ja-mesz work\midterm project draft\midterm project draft\midterm project source draft.cpp(68)' was matched c:\users\hp pc\documents\ja-mesz work\midterm project draft\midterm project draft\midterm project source draft.cpp 134 1 Midterm project draft