

CodePudding user response:
Enter Y/N, before have a number of input, the input Numbers, the need to press the keyboard enter keyThe first getchar, is to get a carriage return '\ n', the second getchar, to get the real Y/n input characters
CodePudding user response:
In order to avoid the getchar twice, can be written as the scanf (" % d \ n ", & amp; Number);CodePudding user response:
Writing the program sometimes use getchar () to receive one character at a time, need to use an empty getchar () eat a carriage return, in front of the scanf, behind to use ch=getchar () receiving characters, middle to use an empty getchar () eat excess return,