| pandabear (2) | |
|
For some reason this code isnt working that well...I need to input the users gender then based off that their height and weight and to exit enter X or x char gender; bool heightOk; bool weightOk; int height; int weight; bool end = false; do{ do{ cout << "Please enter the candidates information (Enter 'x' to exit) " << endl; cout << setw(10) << "Gender: "; cin >> gender; if (gender != 'x' && gender != 'X' && gender != 'F' && gender != 'f' && gender != 'm' && gender != 'M') { cout << "invalid entry" << endl; } }while (gender != 'x' && gender != 'X' && gender != 'F' && gender != 'f' && gender != 'm' && gender != 'M'); if (gender == 'x' || gender == 'X') { end = false; exit(1); } while(!end); if (gender == 'f' || gender == 'F') { cout << setw(10) << "height: "; cin >> height; heightOk = (height >=24 && height <= 110 && height >=60 && height <= 72); cout << heightOk; cout << setw(10) << "weight: "; cin >> weight; weightOk = (weight >= 50 && weight <= 1400 && weight >= 100 && weight <= 185); cout << weightOk; } else {(gender == 'm' || gender == 'M'); cout << setw(10) << "height: "; cin >> height; heightOk = (height >=24 && height <= 110 && height >=62 && height <= 78); cout << heightOk; cout << setw(10) << "weight: "; cin >> weight; weightOk = (weight >= 50 && weight <= 1400 && weight >= 130 && weight <= 250); cout << weightOk; } if (heightOk == 1 && weightOk == 1) { cout << "This candidate has been ACCEPTED!" << endl << endl;} if(heightOk == 0 && weightOk == 1) { cout << " This candidate has been rejected based on the HEIGHT requirement" << endl;} if(heightOk == 1 && weightOk == 0) { cout << "This candidate has been rejected based on the Weight requirement" << endl;} if (heightOk == 0 && weightOk == 0) { cout << "This candidate has been rejected based on the Weight and HEIGHT requirement" << endl;} }while (cout << " " << endl); return 0; } | |
|
|
|
| SamuelAdams (185) | |||||||
|
if would help if you used code tags I don't know what this is but it can't be right while (cout << " " << endl);You should set your int values =0
again, no idea what this does, but can't be right
This just means your running the code one time right ? Why do you need a loop to do that ?
That's about all I can tell until you format it with code tags under Format, click source code >> | |||||||
|
Last edited on
|
|||||||