我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

c语言,有点思路,但写的不对

img

img

看一下,写不对。中间思路感觉不对。遇到字母就不会处理了。要是数字还能写。

#include<stdio.h>
int main() {
    int n;
    char str[202];
    scanf("%d", &n);
    while (n--) {
        scanf("%s", str);
        int count[26] = { 0 };
        scanf("%s", str);
        for (int i = 0; str[i] != '\0'; ++i) {
            count[str[i] - 'A']++;
        }
        int max = 0;
        for (int i = 1; i < 26; ++i) {
            if (count[i] > count[max]) {
                max = i;
            }
        }
        printf("%d*%c\n", count[max], max + 'A');
        scanf("%s", str);
    }
}

近期文章

  • c语言将十个数据存入数组
  • 关于##include#的问题,如何解决?
  • IntersectionObserver 属性优化性能
  • 多级别的不同类型的继承
  • 若依 Springboot
  • 请问图中typeerror错误该怎么解决
  • C++:学生类的设计和实现
  • Python Tkinter :destory错误
  • C#网站接口返回数据给Json解析并显示,为何错误!
  • 简单的dom解析器double find()不起作用?
  • 一级菜单输入的数据 传不到二级菜单。 取消二级菜单(删除二级菜单后)也无法打印 怎么解决?
  • 图中问题该怎么解决呢
  • texstudio怎么打开符号窗格
  • 11和12行的关系希望有朋友帮帮我😭
  • 一打开Rstudio就弹出.libpath(c("新路径","旧路径")ignored
  • python远程服务器,需要保持连接吗
  • AD2022不同层建立不同敷铜规则
  • anaconda虚拟环境
  • android如何将POST json请求发送到Laravel Framework
  • 为什么我的visual studiocC#调试只能看到最后29行?

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华