关于这个代码输出的问题
#include<stdio.h>int main(void)
{
char ch;
while ((ch = getchar()) != '|')
{
printf("lll\n");
}
return 0;
}
随便输入一个字符,不是应该只输出一行lll 但是我编译器怎么输出两行lll? 求解答
while ((ch = getchar()) != '|' && ch != '\n') { printf("lll\n"); }
while ((ch = getchar()) != '|') { printf("lll\n"); while (getchar() == '\n') continue; }