seventeen


私信TA

用户名:uq_59399786318

访问量:3200

签 名:

学习永无止境

等  级
排  名 7062
经  验 1293
参赛次数 0
文章发表 13
年  龄 17
在职情况 学生
学  校 湖北师范大学
专  业

  自我简介:

解题思路:使用字符处理函数

注意事项:源文件包含头文件<ctype.h>

参考代码:

#include <stdio.h>

#include<ctype.h>

#define N 1000

int main()

{

char a[N];

int i,letter=0,number=0,space=0,other=0;

gets(a);

for(i=0;a[i]!='\0';i++)

{

if(isalpha(a[i]))

letter++;

else if(isdigit(a[i]))

number++;

else if(a[i]==' ')

space++;

else

other++;

}

printf("%d %d %d %d",letter,number,space,other);

return 0;

}







 

0.0分

1 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区