Im still new at programming. May i know why the loop doesnt work when i type 'y' ?Code:
do{
....printf("Continue? (Y/N)");
fflush(stdin);
cont = toupper(getchar());
if ((cont!='Y') || (cont!='N')) {
printf("Invalid input! Continue? (Y/N) ");
fflush(stdin);
cont = toupper(getchar());
}
} while(cont=='Y');.....
i don't get what is the problem with the code above as this code below works perfectly well?
Code:int main() {
char x;
x=toupper(getchar());
if (x=='Y') {
printf("print this!\n");
}
return 0;
}