qingxin111 发表于 2008-6-29 14:39

搞不懂!!!

下面这个程序段里的 "while(getchar()!='\n')   ;"为什么能消除输入流里的字符???

printf("please enter an int:");
while(scanf("%d",&n)!=1){
   while(getchar()!='\n')   ;
   printf("input incorrect.an int again");
}
for(i=0;i<n,++i)……

计算机的流氓 发表于 2008-6-29 18:45

while(getchar()!='\n')   ;好像只能输入单个字符把。

himpo 发表于 2008-6-30 08:30

MS问了好多遍了

qingxin111 发表于 2008-6-30 10:04

谁给我个答案啊??????

lintaoxe 发表于 2008-6-30 10:15

俄  俄 俄  MS我到你问好几次。。没人回答你???要反思

页: [1]

编程论坛