#include <iostream> #include <string> #include <windows.h> using namespace std; int main() { string word; int count = 0; int length = 0; cout << "请输入任意多行:" << endl; while (1) { if (!(getline(cin,word))) { break; } count++; length += word.length(); } cout << "一共有" << count << "行" << endl; cout << "一共有" << length << "个字符" << endl; system("pause"); return 0; }