954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need help with simple code

//
#include <iostream>

using namespace std;


int main() {

int age;
int weight;
int height;

cout << "Enter your age." <<endl;
cin >> age;

cout << "Enter your weight (in inches)." <<endl;
cin >> weight;

cout << "Enter your weight (in pounds)." <<endl;
cin >> height;


if ((age >= 18)&&(age <= 35))&&((weight >= 150)&&(weight <= 235))&&((height >= 66)&&(height <= 78));
{
cout << "QUALIFIED" <<endl;
}
else;
{
cout << "DISQUALIFIED" <<endl;
}
return 0;
}

please help me! i get these errors..

army.cc: In function `int main()':
army.cc:25: error: expected identifier before '(' token
army.cc:25: error: expected `;' before '(' token
army.cc:29: error: expected primary-expression before "else"
army.cc:29: error: expected `;' before "else"

DC257209
Newbie Poster
4 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

lines 23 and 28: remove those damned semicolons at the end of the lines.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 
lines 23 and 28

I think Ancient Dragon meant to say lines 23 and27. :)
Don't put semicolons after if and else.

Grn Xtrm
Posting Pro in Training
495 posts since Nov 2008
Reputation Points: 100
Solved Threads: 48
 

thanks!

DC257209
Newbie Poster
4 posts since Sep 2009
Reputation Points: 10
Solved Threads: 0
 

Please mark the thread as solved if you don't need any further help, so people can pass over it instead of wasting there time with an already answered question.
Thanks.

Grn Xtrm
Posting Pro in Training
495 posts since Nov 2008
Reputation Points: 100
Solved Threads: 48
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You