本題要求實現乙個函式,統計給定字串中英文本母、空格或回車、數字字元和其他字元的個數。
void stringcount( char s );
其中 char s 是使用者傳入的字串。函式stringcount須在一行內按照
letter = 英文本母個數, blank = 空格或回車個數, digit = 數字字元個數, other = 其他字元個數
的格式輸出。
#include
#define maxs 15
void stringcount( char s );
void readstring( char s ); /* 由裁判實現,略去不表 */
int main()
else
if(s[i]
==' '
||s[i]
=='\n'
)else
if(s[i]
>=
'0'&&s[i]
<=
'9')
else
}printf
("letter=%d,blank=%d,digit=%d,other=%d"
,letter,blank,digit,other);}
void
readstring
(char s)
/* 由裁判實現,略去不表 */
}int
main()
習題6 1 分類統計字元個數 15分
本題要求實現乙個函式,統計給定字串中英文本母 空格或回車 數字字元和其他字元的個數。函式介面定義 void stringcount char s 其中 char s 是使用者傳入的字串。函式stringcount須在一行內按照 letter 英文本母個數,blank 空格或回車個數,digit 數字...
習題6 1 分類統計字元個數 15分
本題要求實現乙個函式,統計給定字串中英文本母 空格或回車 數字字元和其他字元的個數。void stringcount char s 其中char s是使用者傳入的字串。函式stringcount須在一行內按照 letter 英文本母個數,blank 空格或回車個數,digit 數字字元個數,othe...
習題6 1 分類統計字元個數 15分
本題要求實現乙個函式,統計給定字串中英文本母 空格或回車 數字字元和其他字元的個數。函式介面定義 void stringcount char s 其中 char s 是使用者傳入的字串。函式stringcount須在一行內按照 letter 英文本母個數,blank 空格或回車個數,digit 數字...