#include <iostream>
using namespace std;
int main(void) {
    string word;
    int wordcount = 0;
    int length = 0;

    cout << "请输入若干个单词:" << endl;
    
    while (1) {
        if (!(cin >> word)) {
            break;
        }
        wordcount++;
        length += word.length();
    }
    cout << "单词的个数是:" << wordcount << endl;
    cout << "单词的总长度是:" << length << endl;

    system("pause");
    return 0;
}

 

posted on 2022-08-13 15:34  wshidaboss  阅读(171)  评论(0编辑  收藏  举报