Hello everbody, My first post.
I'm working on a small project for school.
This loop ran once then kicks me out after typing Y. My instructor told me to put the fflush(stdin). I did, and it worked great in my Visual Studio 2008. However, I'm to do this assignment on my school's unix account. I get the same problem again in which the loop runs, then kicks me out even after typing Y.Code:char answer = 'Y';
while (answer == 'Y') {
//do the bulk of the work
printf("Do you want to continue? (Y/N)");
fflush(stdin);
scanf("%c", &answer);
}
What's wrong?
I found this forum after searching for answer. I found a complicated answer involving the buffer (don't know anything abou these). Is writing this loop a nontrivial activity?