Hello,
just a quick question.
Does anyone know why this do...while loop wont evaluate to true when either 'y' or 'n' is entered?
do
{
printf("\nDo you wish to add more results manually?: ");
scanf(" %c", &choice);
}while((choice != 'y') || (choice != 'n'));
However, when the while loop condition is just "while(choice != 'y');" and 'y' is entered, the condition evaluates to true and loop is exited.
And yes, I have considered the carriage return, hence the space before the "%c" in scanf.
Any and all suggestions welcome!
Thanks everyone.
Oxy
we are all of us living in the gutter.
But some of us are looking at the stars.
just a quick question.
Does anyone know why this do...while loop wont evaluate to true when either 'y' or 'n' is entered?
do
{
printf("\nDo you wish to add more results manually?: ");
scanf(" %c", &choice);
}while((choice != 'y') || (choice != 'n'));
However, when the while loop condition is just "while(choice != 'y');" and 'y' is entered, the condition evaluates to true and loop is exited.
And yes, I have considered the carriage return, hence the space before the "%c" in scanf.
Any and all suggestions welcome!
Thanks everyone.
Oxy
we are all of us living in the gutter.
But some of us are looking at the stars.