【请教两个小问题,10分悬赏。。。。。。。。。。。。。】
1.程序启动,请教下如何输入制表符\t,由于作业上说统计\t制表符的输入次数,但我却不知道怎么输入这个?![](zzz/editor/img/code.gif)
#include<stdio.h> void main() { int a=0,b=0,c=0,d; while((d=getchar())!='0') //按0结束程序 { if(d==' ') ++a; //统计空格 if (d=='\t') ++b; //统计\t制表符 if(d=='\n') ++c; //统计换行符 } printf("\n有空格 %d个\n有\\t %d个\n有\\n %d个",a,b,c); getch(); }
2.假若我while((d=getchar())!=EOF) //按什么结束程序呢?
共两个小问题,谢谢大家帮助!
![](images/smilies/emot/em01.gif)
![](images/smilies/emot/em01.gif)
![](images/smilies/emot/em04.gif)