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;
}