The answer comes from Scripter: putting a space before the character '%'. So:
void quit(void)
{
char stop = 0;
for (;;)
{
printf("\nWill you end this banking system? Enter Y/N\n");
scanf(" %c", &stop);
if (stop == 'y' || stop == 'Y')
{
exit(1);
}
else if (stop == 'n' || stop == 'N')
{
return;
}
else
printf("\nIncorrect imput; retry!\n");
}
}
Yes, your way will work.... It may be my "personal" style, I don't know, but I really hate situations where I have to deliver error messages over trivial things, so I tend to do it the way I showed in my last message. Like I said... Y or y is "yes", everything else is "no". Either way... no worries.
It's the " %c" thing that makes the real difference... you should always use that space trick with %c and %s since it is likely the trailing line end from the last input operation is still in the keyboard's buffer. When you launch scanf() without the space, it sees the stray line end, decides you just hit Enter, and returns.
Another way is to #include conio.h and use the fflush(stdin); call to dump the keyboard buffer before each input function.
One last note... your programs should always return 0 or exit(0) to indicate "no error". This value is communicated to scripts and batch files. Many scripting tools will signal an error on non-zero values. If you are signalling an error, use one of the Windows Error Codes as appropriate to the failure...
https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx