Error when trying to run code.

Jan 10, 2016 at 6:05pm
Hi! When I try to run this code, I get an error:
"No match for 'operator <<' in fileout << studentID' "

1
2
3
4
5
6
7
8
string temp;
            while(getline(in, temp))
                studentID.push_back(temp);
                std::sort(studentID.begin(), studentID.end());
                for (size_t i = 0; i < studentID.size(); i++)
                fileout.open("5C");
                fileout << studentID << " " << finalScore << endl;
                fileout.close();


The error occurs on the fileout output line. Thanks!
Jan 10, 2016 at 6:10pm
Well, by the looks of it studentID is a vector.

So what exactly do you think this means fileout << studentID

If you want to output a vector, just like arrays, you're gonna have to use a for-loop and output each element of the vector.
Jan 10, 2016 at 6:10pm
What kind of object is studentID? The compiler does not know what to do with that kind of object in this situation.
Last edited on Jan 10, 2016 at 6:11pm
Topic archived. No new replies allowed.