L1-003 个位数统计 (15分)
发布日期:2021-05-12 21:28:37 浏览次数:10 分类:精选文章

本文共 1532 字,大约阅读时间需要 5 分钟。

���������������������������������������������������������������������������������������������������������������������������������1000���������������������������������������������������������������������������������������������������������������

������������

���������������������������������������������������������������������������������������������������������

  • ������������������������10���������������������������������0���9���������������������
  • ������������������������������������������������������������������������������������������������������
  • ���������������������������������������������������������
  • ���������������������������������������������������������
  • ������������

    #include 
    using namespace std;int main() { int count[10] = {0}; char n; // ��������������������������������������������� while ((n = getchar()) != '\n') { count[n - '0']++; } // ������������������������������������ for (int i = 0; i < 10; ++i) { if (count[i] != 0) { cout << i << ":" << count[i] << endl; } } return 0;}

    ������������

  • ���������������������������getchar()���������������������������������������������������������������������������������������'3'������������'3'���
  • ���������������������������������������������n - '0'���������������������������������������������
  • ������������������������������������������������������������������������������������������������
  • ������������������������������������1000���������������������������������������������������������

    上一篇:L1-005 考试座位号 (15分)
    下一篇:7-1-2 输入输出 plus 正整数A+B (300分)

    发表评论

    最新留言

    网站不错 人气很旺了 加油
    [***.192.178.218]2025年04月23日 22时49分05秒