Beginner problem: I keep getting "no operator " <<" matches these operands."

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
using std::string;

int main()
{
string word;
while (cin >> word); // read until end-of-file
			cout << word << endl; // write each word followed by a new line
return 0;
}


It keep saying: no operator " <<" matches these operands on line 10 and 11
You need #include <string>

Also, get rid of the ; on line 10. It's terminating your while loop.
As it is, you're only going to print the last word of the file.

Worked, thanks.
Topic archived. No new replies allowed.