i have a class called employee and i am trying to create multiple employees from this class based from a text file.
I can add/remove employees from the text file so i do not know how many employees i want to make each time i run the program.
to combat this i have created a variable total_lines and counted the number of lines in the text file.
however when i do:
employee(total_lines)
i get an error which says:
"Expression must have a constant value"
however i do not know the value as it could change each time i run the program.
is there a way to navigate this?
if you are doing objects, that would get rid of the need to pass the vectors in and out of the functions entirely; the vector becomes a member and the member functions can all see it and change it directly without passing. If this is past where you are in your study, leave it for now but note it in the back of your mind as one of the key advantages of objects (its a lot like having global variables within a limited segment of the code, all the advantages of that idea, without the pain points).