current position:Home>The input value is incorrect. There are two inputs, but only one can be entered

The input value is incorrect. There are two inputs, but only one can be entered

2022-02-02 21:23:00 CSDN Q & A

I wrote a code , Then there is scanf Function input , also gets Function input , Why did you enter a 3, After entering, you can't enter any more strings ?( Because the string has spaces , So use gets Input )

img

img




Refer to the answer 1:

gets(); front Add one getchar() Because of you. scanf Read only 3 Left a carriage return The carriage return was gets() Read gets It's over




Refer to the answer 2:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202022122588484.html

Random recommended