📜  将输入流分解为单词 - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:55.439000             🧑  作者: Mango

代码示例1
int countWords(string str) {
    stringstream s(str);
    string word;
    int count = 0;
    while (s >> word)
        count++;
    return count;
}