Hello, I'm trying to print values from a vector of a struct and I don't really know how to do that. Here is a simple code that I have for now to test how to add data to the vector then attempt to print it out.
The compiler shall issue an error for this statement
cout << AddEmployee.ID << endl;
AddEmployee is an object of type std::vector<Employee>. The record AddEmployee.ID means that you are trying to call method ID declared in class std::vector. However class std::vector has no such a method. So before accessing ID you should get an object of type Employee where this data member is declared. The simplest way is to use the subscripting operator of class std::vector
cout << AddEmployee[0].ID << endl;
AddEmployee[0] returns an object of type Employee that has data member ID.