#include<stdio.h>
int main(void)
{
    int digit,letter,blank,other;
    char ch;

    int i;
    digit=letter=other=blank=0;
    printf("Enter 15 characters:");
    for(i=1;i<=15;i++){
        ch=getchar();
        if((ch>='a'&&ch<='z')||(ch>='A'&&ch<='Z'))
            letter++;
        else if(ch>='0'&&ch<='9')
            digit++;
        else if(ch>=' '||ch<='\r')
            blank++;
        else
            other++;
    }
    printf("letter=%d,digit=%d,blank=%d\n,other=%d\n",letter,digit,blank,other);


    return 0;
}

作业三-3输入 15 个字符,统计其中英文字母、空格或回车、数字字符和其他字符的个数

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2021-08-04
  • 2021-12-13
  • 2022-12-23
相关资源
相似解决方案