#include <stdio.h>
int main(int argc
, const char * argv
[]) {
char c
;
int letters
=0,space
=0,digit
=0,others
=0;
while((c
=getchar())!='#')
{
if ((c
>='a'&&c
<='z')||(c
>='A'&&c
<='Z')) {
letters
++;
}
else if(c
==' ')
{
space
++;
}
else if (c
>='0'&&c
<='9')
{
digit
++;
}
else
{
others
++;
}
}
printf("letters=%d,space=%d,digit=%d,others=%d\n",letters
,space
,digit
,others
);
return 0;
}
output:
123456qwerty \\\\
#
letters=6,space=1,digit=6,others=5
Program ended with exit code
: 0
转载请注明原文地址:https://ipadbbs.8miu.com/read-16344.html