How can I print out the record of specific staff using vector in C++? [closed]

i assume you have a class that contains your staff
your vector would look like

vector<Staff> staff; // Staff would be replaced with your class name

then you can create a loop to populate your vector

for (int i=0;i<n;i++) // where n is the number of staff
{
staff.push_back(worker) // push back what ever function you have to to create a worker
}

then you can loop over your vector to print its content

  for (int i=0;i<staff.size();i++)
{ 
cout << staff[i].print() <<endl; // where print is a function in your class to print out the work
}

Leave a Comment