### Repetition and Boolean Expressions Help Please

I need to make a program that asks for a user's gender, height, and weight and then based off their inputs, it then decides if they are accepted or not.

 ``12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667`` `````` char gender; bool heightOk; bool weightOk; int height; int weight; // PROCESSING - ask for the user's gender, height and weight do { cout << left << "Please enter the candidate's information"; cout << "(enter 'X' to exit)\n"; cout << "Gender: "; cin.get(gender); if (gender != 'x' && gender != 'X' && gender != 'F' && gender != 'f' && gender != 'm' && gender != 'M') { cout << "invalid entry" << endl; } if (gender == 'f' || gender == 'F') { cout << "height: "; cin >> height; heightOk = (height >= 62 && height <= 75); cout << heightOk; cout << "weight: "; cin >> weight; weightOk = ( weight >= 110 && weight <= 185); cout << weightOk; } if (gender == 'm' || 'M') { cout << "height: "; cin >> height; heightOk = (height >= 65 && height <= 80); cout << heightOk; cout << "weight: "; cin >> weight; weightOk = (weight >= 130 && weight <= 250); cout << weightOk; } else { cout << "please enter a valid gender"; } } while (gender != 'x' && gender != 'X' && gender != 'F' && gender != 'f' && gender != 'm' && 'M') // OUTPUT - Output each grade, the GPA, and the grade point total return 0; }``````

Everytime I enter 'm' it says invalid entry and I'm not understanding why.
You will find that entering any letter will receive the invalid entry error. You need to change your &&'s to ||'s after inputting gender.

I'd also suggest look at the if statement for males, there is something wrong there. If you need a hint, look at the if statement for females.
I changed some parts like you said but I'm still getting invalid entry.

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657`` ``````do { cout << left << "Please enter the candidate's information"; cout << "(enter 'X' to exit)\n"; cout << "Gender: "; cin.get(gender); if (gender != 'x' || gender != 'X' || gender != 'F' || gender != 'f' || gender != 'm' || gender != 'M') { cout << "invalid entry" << endl; } if (gender == 'f' || gender == 'F') { cout << "height: "; cin >> height; heightOk = (height >= 62 && height <= 75); cout << heightOk; cout << "weight: "; cin >> weight; weightOk = ( weight >= 110 && weight <= 185); cout << weightOk; } if (gender == 'm' || gender == 'M') { cout << "height: "; cin >> height; heightOk = (height >= 65 && height <= 80); cout << heightOk; cout << "weight: "; cin >> weight; weightOk = (weight >= 130 && weight <= 250); cout << weightOk; } else { cout << "please enter a valid gender"; } } while (gender != 'x' || gender != 'X' || gender != 'F' || gender != 'f'|| gender != 'm' || 'M'); // OUTPUT - Output each grade, the GPA, and the grade point total return 0; }``````
Sorry, I was wrong, you did need the &&'s.

I, however, ran your initial code that you pasted and it works fine, or for as much as you have done so far. Are you typing
 `'m'`
or
 `m`
? You need to just type m then press enter. If you're typing
 `'m'`
you're getting the error because it's reading the quote as your character.
I'm entering just a single m. No quotes or anything. I'll give you the output I'm getting.

So I went back to the previous format I think it was just the if statement for the male that was screwing it up. here's my output though I'm not sure why I'm getting the 1 before weight and the random 1 at the bottom.

 ```Please enter the candidate's information(enter 'X' to exit)Gender: m height: 80 1weight: 130 1```
I know what the deal is. Its outputting heightOk and weightOk as 1 because it stores true as 1 and I'm outputting it.
Topic archived. No new replies allowed.