#include<stdio.h>
#include<string.h>
int i,ch,num,kon,other;
int main()
{
void insert(char[]);
char str[80];
printf("input four digits:");
gets(str); /* 此处用gets输入字符串会全部输入,若用scanf("%s",str);则到第一个空格处就停止录入了,空格后直接舍弃》*/
ch=0;
num=0;
kon=0;
other=0;
insert(str);
printf("output :\n%d %d %d %d\n",ch,num,kon,other);
return 0;
}
void insert(char str[])
{
for(i=0;str[i]!='\0';i++)
{
if((str[i]>='A'&&str[i]<='Z')||(str[i]>='a'&&str[i]<='z'))
ch++;
else if(str[i]>='0'&&str[i]<='9')
num++;
else if(str[i]==32)
kon++;
else
other++;
}
}
#include<string.h>
int i,ch,num,kon,other;
int main()
{
void insert(char[]);
char str[80];
printf("input four digits:");
gets(str); /* 此处用gets输入字符串会全部输入,若用scanf("%s",str);则到第一个空格处就停止录入了,空格后直接舍弃》*/
ch=0;
num=0;
kon=0;
other=0;
insert(str);
printf("output :\n%d %d %d %d\n",ch,num,kon,other);
return 0;
}
void insert(char str[])
{
for(i=0;str[i]!='\0';i++)
{
if((str[i]>='A'&&str[i]<='Z')||(str[i]>='a'&&str[i]<='z'))
ch++;
else if(str[i]>='0'&&str[i]<='9')
num++;
else if(str[i]==32)
kon++;
else
other++;
}
}