《输入一行字符-分别统计出其中字母、空格、数字和其他字符的个数》由会员分享,可在线阅读,更多相关《输入一行字符-分别统计出其中字母、空格、数字和其他字符的个数(1页珍藏版)》请在金锄头文库上搜索。
输入一行字符,分别统计出其中字母、空格、数字和其他字符的个数。#includeint letter,digit,space,others;void main() void count(char); char text80; printf(Please string:n); gets(text); printf(string:n); puts(text); letter=0; digit=0; space=0; others=0; count(text); printf(letter:%d,digit:%d,space:%d,others:%dn,letter,digit,space,others);void count(char str) int i; for(i=0;stri!=0;i+) if(stri=a&stri=A&stri=0&stri=9) digit+; else if(stri=32) space+; else others+;