Problems
1. Results for height and weight output fine but I am trying to have gender change the following boolean assignment statements. 2 different results for height and weight base on either female or male.

exp.
males height is (height >= 62 && height <= 78)
but for the female (height >60 && height <=72)

2. Is when both weight and height are both incorrect it outputs:
This candidate has been rejected based on the height requirement.
This candidate has been rejected based on the weight requirement.
This candidate has been rejected based on both weight and height requirement.

I just need it to say
This candidate has been rejected based on both weight and height requirement.

#include<iostream>

using namespace std;

int main ()
{
	char gender;
	float weight;
	float height;
	bool heightOk;
	bool weightOk;

	gender='m'||'M'||'F'||'f';

    //user to enter gender
	cout << "Gender: ";
	cin >> gender;

    //user to enter height
	cout << "Height: ";
	cin >> height;

        //user to enter weight
	cout << "Weight: ";
	cin >> weight;

    //if input for height is valid
	if (height >= 62 && height <= 78)
		heightOk=true;
	else
		heightOk=false;

  //if height invalid outputs error message
	if (!heightOk)
		cout << "This candidate has been rejected based on the height requirement.";

    //if input for weight valid
	if (weight >= 130 && weight <= 250)
		weightOk=true;
	else
		weightOk=false;


    //if input is invalid outputs error message
	if (!weightOk)
		cout << "This candidate has been rejected based on the weight requirement.";

    //if both weight & height valid ouputs
	if (weightOk && heightOk)
		cout <<"This candidate has been accepted.";

    //if both weight & height  invalid outputs
	if (!weightOk && !heightOk)
		cout <<"This candidate has been rejected based on both height and weight requirement.";


	return 0;



}

I have made an effort trying to find the answers to my problems been searching for hours and trying all different codes i have another set of code but that one is full of errors. so i appreciate any effort in helping.

That's really simple....

#include<iostream>

using namespace std;

int main ()
{
	char gender;
	float weight;
	float height;
	bool heightOk;
	bool weightOk;

	gender='m'||'M'||'F'||'f';

    //user to enter gender
	cout << "Gender: ";
	cin >> gender;

    bool male = gender == 'm' || gender == 'M';

    //user to enter height
	cout << "Height: ";
	cin >> height;

        //user to enter weight
	cout << "Weight: ";
	cin >> weight;

    //if input for height is valid
	if ((male && height >= 62 && height <= 78) || (!male && height >= 60 && height <= 72)) 
		heightOk=true;
	else
		heightOk=false;

    //if input for weight valid
	if (weight >= 130 && weight <= 250)
		weightOk=true;
	else
		weightOk=false;


    //if both weight & height valid ouputs
	if (weightOk && heightOk)
        {
		cout <<"This candidate has been accepted.";
                return 0;
         }

    //if both weight & height  invalid outputs
	if (!weightOk && !heightOk)
        {
		cout <<"This candidate has been rejected based on both height and weight requirement.";
                return 0;
        }

  //if height invalid outputs error message
	if (!heightOk)
        {
		cout << "This candidate has been rejected based on the height requirement.";
                return 0;
         }

    //if input is invalid outputs error message
	 cout << "This candidate has been rejected based on the weight requirement.";
         return 0;

}

I see jencas addressed the first problem. I think that, from what you originally posted, you need to check gender when comparing weights as well.
Concerning the second problem, the last two "if" statements should be changed to "else if" so one one of the three cases can execute.

This article has been dead for over six months. Start a new discussion instead.