刚刚入门,太多不会的知识了,看了好久都不会,要求用while语句,希望回答能对我这个初学者友好点,,谢谢大家
4条回答 默认 最新
- adgentleman 2019-04-08 18:00关注
#include <stdio.h> #include <string.h> //输入的字符串的最大长度 #define LENGTH (1024) int main() { char input_str[LENGTH]; int i = 0; int real_length = 0; char word; int sum = 0; printf("请输入字符串:"); scanf("%s", input_str); //获取字符串的最大长度 real_length = strlen(input_str); while (i < real_length) { word = input_str[i]; if (word >= 'a' && word <= 'z') //小写字母 { sum++; } else if (word >= 'A' && word <= 'Z') //大写字母 { sum++; } else { } i++; } printf("sum=%d\n", sum); return 0; }
解决 无用评论 打赏 举报
悬赏问题
- ¥15 素材场景中光线烘焙后灯光失效
- ¥15 请教一下各位,为什么我这个没有实现模拟点击
- ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
- ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
- ¥20 有关区间dp的问题求解
- ¥15 多电路系统共用电源的串扰问题
- ¥15 slam rangenet++配置
- ¥15 有没有研究水声通信方面的帮我改俩matlab代码
- ¥15 ubuntu子系统密码忘记
- ¥15 保护模式-系统加载-段寄存器