解题思路:
注意事项:
参考代码:
#include<iostream>
using namespace std;
int main(void)
{
int num=0,space=0,word=0,other=0;
char input;
while((input=getchar())!='\n')
{
if(input>='0'&&input<='9')num++;
else if(input==' ')space++;
else if(input>='a'&&input<='z'||input>='A'&&input<='Z')word++;
else
other++;
}
cout<<word<<" "<<num<<" "<<space<<" "<<other;
system("pause>0");
}
0.0分
0 人评分