Hey! I was wondering whether anyone could find the error here? The user inputs their choice and depending on their choice, they are to input which object they are to display. However, whenever the user inputs something other than y for yes, loop continues to move on, which is not what is desired. If a user types on no, for example, i want it to end. How can I fix it?
bool validChoice = false;
bool validate = false;
char choice;
int i;
do{
cout << "Would you like to see any of the polygons you've created? Enter y for yes, n for no." << endl;
cin >> choice;
if ('Y'|| 'y'){
do{
cout << "Which object would you like to see?" << endl;
cin >> i;
if ( i <= N){
pol[i-1] -> DrawPolygon();
validate = true;
validChoice = true;
}
}while(!validate);
}
}while(!validChoice);