The cout statement in this for loop:
for (vector<Student>::iterator qw = students.begin(); qw != students.end(); ++qw){ Student a = *qw; name = a.getName(); regno = a.getRegNo(); std::cout << "Name: "<< name << " Reg Number: " << regno << endl; }
It creates some kind of odd behavior, what cout should print looks something like this:
Name: Mike Sanderson Reg Number: 10101
However, he does print it out:
Register Number: 10101on
It seems to me that after the second part of the cout statement, it returns to the beginning of the line and overwrites itself, but why? I hope you guys can help me, and if you need more information let me know!
source share