📄 lind6-2.c
字号:
#include<stdio.h>
void main()
{
char str;
int words=0,space=0,number=0,others=0;
while((str=getchar())!='\n')
{
if(str==32)
{
space++;
}
else if(((str>=65)&&(str<=90))||((str>=97)&&(str<=122)))
{
words++;
}
else if((str>=48)&&(str<=58)) //What will happen if I change the second and the third 'if' into 'else if'?
{
number++;
}
else
{
others++;
}
}
printf("\nwords %d number %d space %d others %d\n\n",words,number,space,others);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -