编写函数,统计一个字符串中大写字母、小写字母和数字各有多少.

[复制链接]
查看11 | 回复2 | 2019-7-3 18:07:01 | 显示全部楼层 |阅读模式
package cn.itcast_06;public class StringDemo3 {public static void main(String[] args) {// 定义一个字符串String s = "Hello12345685757World";// 定义三个统计变量int bigCount = 0;int smallCount = 0;int numberCount = 0;// 遍历字符串,得到每一个字符。xfor (int i = 0; i #include #define n 50void main(){ int i=0,littlechar=0,bigchar=0,space=0,num=0,other=0;char a[n];gets(a);while(a!='\0'){if(a>='a'...
回复

使用道具 举报

千问 | 2019-7-3 18:07:01 | 显示全部楼层
#include #define N 200void count(char *);int main(){
char *ch,chr;
ch=malloc(N+1);
printf("请输入输入一行字符:\n");
gets(ch);
count(ch);
getc...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行