習題6 1 分類統計字元個數 15分

2021-10-02 19:43:51 字數 535 閱讀 3448

本題要求實現乙個函式,統計給定字串中英文本母、空格或回車、數字字元和其他字元的個數。

函式介面定義:

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()

printf

("letter = %d, blank = %d, digit = %d, other = %d"

,letter,blank,digit,other)

;}

習題6 1 分類統計字元個數 15 分

本題要求實現乙個函式,統計給定字串中英文本母 空格或回車 數字字元和其他字元的個數。void stringcount char s 其中 char s 是使用者傳入的字串。函式stringcount須在一行內按照 letter 英文本母個數,blank 空格或回車個數,digit 數字字元個數,ot...

習題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 數字...