Hello, I am creating a program that that passes structure arrays through functions. I Am trying to get user input to add information to a strut variable using a function. I am getting an error message on the get user input line that reads " field'employee_id' cannot be resolved. Any suggestions to fix this error and BTW the program is not yet finished.
In your get_jd function, a is not a Payroll object. a is an array of Payroll objects. To get a single Payroll object from the array, you use:
a[index].
To access the member of that Payroll object, you use:
a[index].element
Why do you have an array of payrolls, of size num_workers, when each payroll then contains several arrays that are also of size num_workers? That seems redundant to me.
Um... I'm not quite sure what you mean by that. But the point is, you need to think clearly about how you organize your data. Do you want one Payroll, which contains data for all workers? Or do you want lots of Payrolls, one for each worker?
I want to organize lots of Payrolls for each worker. The problem I am running into now is when I am getting user input the program keeps running, like there is an infinite loop going on. Would the cin ignore statement fix this?
I want to organize lots of Payrolls for each worker.
You want each worker to have lots of Payrolls?
Or do you want each worker to have one Payroll?
The problem I am running into now is when I am getting user input the program keeps running, like there is an infinite loop going on. Would the cin ignore statement fix this?
Without seeing the current version of the code, there's really no way we can do anything other than guess.