Home > Back-end >  Excuse me why will continue to input
Excuse me why will continue to input

Time:03-23

CodePudding user response:

The number of input results, the scanf (" % d \ n ", & amp; N); Inside the \ n more,

CodePudding user response:

Remove the scanf in \ n, otherwise can't input end of ~

CodePudding user response:

1. The scanf () met whitespace stopped reading data input,
2. The scanf () ignore buffer the forerunner of whitespace,
3. When the parameter is % c, return to the first character in the buffer, including whitespace,
That is to say, in this line of code "the scanf (" % d \ n"); To buffer read twice, to stop the scanf (); Hit enter after, the first buffer read % d, program stop waiting read \ n, due to ignore the forerunner of whitespace, procedures have been waiting for, until meet a non blank FuCai continue to read,
  • Related