typedef size_t COUNT;
COUNT spaseCh = 0;
COUNT othersCh = 0;
const char* sc = inputStr;
while (*sc != '\0') {
if (isspase(*sc)) {/* isspase是C标准库函数,功能是判别ASCII"空白"字符。需要包含ctype.h */
++spaseCh;
}
else {
++othersCh;
}
++sc;
}
print spaseCh,othersCh
温馨提示:答案为网友推荐,仅供参考