trouble outputing string object to screen.
Code:
void ListFileMem(StudentRecord** Records, int numRecords){
cout<<"LIST RECORDS FROM MEMORY";
string fullname, firstname, lastname;
if (numRecords>0)
{
for (int k=0; k<numRecords;k++)
{
firstname=Records[k]->firstName;
firstname+=" ";
lastname=Records[k]->lastName;
fullname=firstname;
fullname+=lastname;
cout<< fullname; //compiler does not like this. why? //line 269
//cout<<"Record"<<k<<"\n\t"<<"Name: " << fullname;cout<<"\n\t"<<"ID:"<<Records[k]->id
// <<" "<<"Mark:"<<Records[k]->mark<<endl;;
}
}
else
cout<<"memory empty, unable to list\n";
}
Code:
getting error message from ms 2003 compiler:
n:\assignment0.cpp(269): error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)
what is wrong?