写一个跳出循环语句的时候,报错显示C++ 没有与这些操作数匹配的 "=="运算符 操作数类型为: std::basic_istream<char, std::char_traits> == int
#include <iostream>
#include <string>
#include <Windows.h>
using namespace std;
int main(void) {
string word;
int num = 0;
int length = 0;
cout << "请输入一个单词" << endl;
while (cin >> word) {
if ((cin >> word) == 0) {
break;
}
num = num + 1;
length = length + word.size();
cout << "您第" << num << "次输入的单词是" << word << endl;
cout << "他的长度是" << word.size() << endl;
cout << "单词的总长度是" << length << endl;
cout << "请继续输入" << endl;
}
}
请问这个错误怎么解决