//it calculates the number of space/tab/enter key of the string you input from the keybord. But when I run it and input the string with "CTRL-Z" to end, nothing display on the dos screen. why??
Code:
#include<stdio.h>
#include <string.h>
int main()
{
char c;
int space=0,table=0,enter=0;
printf("please input a string:\n");
scanf("%c",&c);
while(c!=(char)EOF)
{
switch(c)
{
case 32:space++;break;
case 9:table++;break;
case 10:enter++;break;
default : break;
}
scanf("%c",&c);
}
printf("the number of space:%d\n",space);
printf("the number of table:%d\n",table);
printf("the number of enter:%d\n",enter);
getchar();
return 0;
}