统计字符(82.2).txt
来自「c程序」· 文本 代码 · 共 22 行
TXT
22 行
#include<stdio.h>
void main()
{
char c;
int ying=0,space=0,shu=0,others=0;
printf("请输入一行字符:");
while((c=getchar())!= '\n')
{
if(c>='a' && c<='z' || c>='A' && c<='Z')
ying++;
else if(c==' ') //''表空格。
space++;
else if(c>='0' && c<='9')
shu++;
else
others++;
}
printf("经过统计为:ying=%d space=%d shu=%d others=%d\n",ying,space,shu,others);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?