scanf不接收空格,回车,遇到时认为输入结束。
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
char c[100];
scanf("%s", c);\\第一次scanf,输入带有空格的两个单词,例如:hello world
puts(c);
printf("下一行我还没输入呢,但是在缓冲区里\n");
scanf("%s", c);\\这里没有资格再输入了.....
puts(c);
system("pause");
}
输入:
hello world
输出:
hello
下一行我还没输入呢,但是在缓冲区里
world
请按任意键继续. . .