0
Follow
0
View

Questions about #c language # :

eando2012 注册会员
2023-02-28 02:46
< div class = " md_content_show“数据- v - 3967 e397 = " " >

< div class = " aw-list-img " > img

czc840725 注册会员
2023-02-28 02:46
< div class = "md_content_show e397 data - v - 3967" = "" >

no sense, I can run here

dingashuai 注册会员
2023-02-28 02:46

Look at this code:

#include
#include 
int main()
{    
    int count_num = 0, count_ABC = 0, count_abc = 0, count_others = 0;    
    int i = 0;    
    char str[255];    
    scanf("%s", &str);    
    i = 0;    
    while (str[i])
    {
        printf("%c", str[i]);
        int ASC = str[i];        
        if (ASC >= 65 && ASC <= 90)//大写字母            
        count_ABC++;        
        else if (ASC >= 97 && ASC <= 122)//小写字母            
        count_abc++;        
        else if (ASC >= 48 && ASC <= 57)//数字            
        count_num++;        else            
        count_others++;        
        i++;
    }    
    printf("大写字母个数:%d\n小写字母个数:%d \n数字个数:%d\n 其他:%d\n", count_ABC, count_abc, count_num, count_others);    
    return 0;
}
stvotvcctv 注册会员
2023-02-28 02:46
< div class = "md_content_show e397 data - v - 3967" = "" >

hope to adopt

dlp_rong 注册会员
2023-02-28 02:46
); while ((c = getchar ()) && c!= '\n' ) { if ((c >= 'a' && c <= 'z' )|| (c >= 'A' && c <= 'Z' )) letters++; else if (c == ' ' ) space++; else if (c >= '0' && c <= '9' ) digit++; else other++; } printf ( "字母数:%d\n空格数:%d\n数字数:%d\n其他字符数:%d\n" , letters, space, digit, other); return 0 ; } .
< !- - - - - >
dyl1207 注册会员
2023-02-28 02:46
< div class = "md_content_show e397 data - v - 3967" = "" >

excuse me why doesn't the scanf(" % c", c);

cxj19861215 注册会员
2023-02-28 02:46

scanf cannot enter Spaces, so getchar does it instead.

About the Author

Question Info

Publish Time
2023-02-28 02:46
Update Time
2023-02-28 02:46

Related Question

QML中的QMessageBox::aboutQt等价于什么?

VScode配置Latex报错Code language not supported or defined,如何解决?

在changeLanguage后不能获得i18n值

DMS CDC - about LogSequenceNumber

我们如何使用React前端和WordPress在相同的目录(例如:abc.com:在React, abc.com/about-us(在WordPress))?

LanguageUtil升级.get方法

Information about LinkedIn API Request

dev c++ language是空白怎么办?

Haskell构建问题(模块的Language.Haskell.TH.语法'不导出' returnQ')

Accept-Language和navigator.languages的区别