zoukankan      html  css  js  c++  java
  • 作业三-3

    /*输入 15 个字符,统计其中英文字母、空格或回车、数字字符和其他字符的个数*/
    #include<stdio.h> int main(void) { int digit,letter,blank,other; /*digit,letter,blank,other分别代表英文字母,空格或回车,数字字符和其他字符的个数*/
    char ch; /*定义一个字符变量ch*/
    int i; /*赋初值为0*/
    digit
    =letter=other=blank=0; printf("Enter 15 characters:"); /*用for函数分别计算累加 */
    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<=' ')
    /*" "代表回车*/ blank
    ++; else other++; } printf("letter=%d,digit=%d,blank=%d ,other=%d ",letter,digit,blank,other); return 0; }

  • 相关阅读:
    bootstrap 兼容 IE8
    在IE8的基础上安装IE11
    前台
    dll 库文件下载地址
    年轻
    linux 异常
    Navicat断网时连不上数据库
    jQuery
    破解版 Teamver 安装
    mysql
  • 原文地址:https://www.cnblogs.com/xym0914/p/3376513.html
Copyright © 2011-2022 走看看