How to traverse vector<string>?

  • Thread starter Thread starter Jeff0803
  • Start date Start date
J

Jeff0803

Guest
I made a vector<string> like following

vector<string> philosopher = { "Kant", "Plato", "Hume", "Kierkegaard" };
for (string x:philosopher) //for each x in v
cout << x << endl;

However compile error occur.

Error C2679 binary '<<': no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)

How to make it work?

Continue reading...
 
Back
Top