A391.统计字符题解:
2026-02-13 21:15:14
发布于:四川
0阅读
0回复
0点赞
A391.统计字符
#include<bits/stdc++.h>
using namespace std;
int main(){
char a;
int i,k=0,m=0,n=0;
while(a=getchar(),a!='?'){
if(a>='0'&&a<='9'){//是否数字
k++;
}
else if((a>='A'&&a<='Z')||(a>='a'&&a<='z')){//是否大写或小写
m++;
}
else{
n++;
}
}
cout<<"Letters="<<m<<endl<<"Digits="<<k<<endl<<"Others="<<n<<endl;//输出
return 0;
}
这里空空如也






有帮助,赞一个