Update README.md

master
pvpnwutk5 4 years ago
parent a6e0fa00aa
commit c5cea3e53f

@ -1,2 +1,31 @@
# f
//字符类型判断
#include <stdio.h>
void count(char *s, int *digit, int *letter, int *other, int *lower, int *k)
{
int i;
for(i=0;i<10;i++)
{
if(s[i]>='a'&&s[i]<='z')
(*letter)++;
else if(s[i]>='A'&&s[i]<='Z')
(*lower)++;
else if(s[i]>'0'&&s[i]<'9')
(*digit)++;
else if(s[i]==' ')
(*k)++;
else
(*other)++;
}
}
int main()
{
int x=0,y=0,z=0,a=0,b=0;
char ch[80];
printf("Enter a string:");
gets(ch);
count(ch,&x,&y,&z,&a,&b);
printf("小写字母有:%d个,大写字母有:%d个,数字有: %d个,空格有: %d个,其它符号有:%d个\n",x,y,z);
}

Loading…
Cancel
Save