编辑:这个问题解决了。谢谢你的所有答案
这是我的程序:
#include <stdio.h>
int main(){
printf("write something : \n");
int c = getchar();
while((c = getchar()) != EOF){
if (c == ' ' || c == '\t')
printf(" \n");
else
putchar(c)
}
return 0;
}
每次我运行它时,它都可以正常工作,但是会吃掉我输入的第一个字符,例如当我运行程序时,输出如下所示:
write something :
this is a sentence.
his
is
a
sentence.
“t”不见了。为什么会发生这种情况,我该如何解决?
感谢您的时间。