hello,
i am usung the following code in C++
std::cout<<"\nDo You Want To Solve Another Quadratic
Equation?\nYes(y==Y) No(n==N): ";
fflush(stdin); // flush input buffer
int sel = tolower(getchar());
while(sel != 'y' && sel != 'n')
{
std::cout<<"\nEither Choose \"y or Y\" For \"YES\" OR \"n or N\"
For \"NO\": "<<std::endl;
fflush(stdin); // flush input buffer
sel = tolower(getchar());
}
if(sel == 'y')
{
system("cls");
goto Start;
}
else
return 0;
}
to clear the program and go back to the start of it.
i.e. once you have worked out one quadratic it gives you the option
whether to do another or quit.
is there a better way of writing this code, because my teacher says
that i should not use fflush(stdin);
thanks