The header that we received in our lab was simply this
Code:
ostream &operator<<(ostream & out, Staff &s)
istream &operator>>(istream & in, Staff &s)
The parameter s, like you said not that well but what I came up with so far is this
Code:
ostream &operator<<(ostream & out, Staff &s)
{
out << s.ID;
out << s.Name;
out << s.Department;
out << s.Position;
out << s.DateJoined;
out << s.Salary;
return out;
}
and for in >>
Code:
istream &operator>>(istream & in, Staff &s)
{
in >> s.ID;
in >> s.Name;
in >> s.Department;
in >> s.Position;
in >> s.DateJoined;
in >> s.Salary;
return in;
}
Because according to our instructor, we should be able to declare a variable of type Staff in the driver and then be able to
Code:
Staff somestaff;
cout << somestaff << endl;
cin >> somestaff;
Is there any suggestions on how to properly format the way the user can enter the information? Any suggestions is appreciated.