Here is some code which I can not understand why I get an error.
This is the error I get from Visual C++
(30) : error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' (or there is no acceptable conversion)
What am I doing wrong??
It is just reading some text from a file, putting it into a struct, then in to a vector. Now I would like to read what is in the vector.
Would appreciate any pointers.
using namespace std;
vector <string> preq;
vector <course> read_catalog(vector<course> &catalog);
vector <course> catalog;
for(int i=0; i<catalog.size(); i++)
cout << catalog[i].name << endl;
vector <course> read_catalog(vector <course> &catalog)
string line, part;
cout<<"Failure to open file";
getline(fin,line); //taking in a whole line from file
stringstream sin(line); //converting string line to a stream
getline(sin, part, ','); //taking a line until a comma is found
c.name = part;
c.num = part;
const char *st = part.c_str(); //string part is convert to cstring
c.credits = atoi(st); //st is converted to an integer and put in struct