I can't quite understand how to pass structure variables. I've been trying to do it by reference but can't remember how. Please give me the prototypes and actual code for the functions. I want to pass a structure called Employee. The Employee variable is called objEmp. Like this:
struct Employee
{
char lname[100];
char fname[100];
int Wage;
int Hours;
int Pay;
}
void getInfo();
void calc();
int main()
{
getInfo();
}
void getInfo()
{
int Index = 0;
Employee objEmp[10];
cout<<"LName: ";
cin>>objEmp[Index].lname;
(It goes on)
calc(?????????????) /*How do I pass the structure and Index? This function will be called again and again for 9 other people to enter their info so Index needs to increment in the calc function and returned to getInfo. */
}
It'll be run like, first employee has the index number of 0 so everything inside objEmp.lname has my last name and then it goes to 1 for the next employee and he has his name in objEmp.lname and eventually I'll have to print off all the data in another function for all of them together. Like Employee #1 Name, LName Employee #2 Name, LName. Etc...
struct Employee
{
char lname[100];
char fname[100];
int Wage;
int Hours;
int Pay;
}
void getInfo();
void calc();
int main()
{
getInfo();
}
void getInfo()
{
int Index = 0;
Employee objEmp[10];
cout<<"LName: ";
cin>>objEmp[Index].lname;
(It goes on)
calc(?????????????) /*How do I pass the structure and Index? This function will be called again and again for 9 other people to enter their info so Index needs to increment in the calc function and returned to getInfo. */
}
It'll be run like, first employee has the index number of 0 so everything inside objEmp.lname has my last name and then it goes to 1 for the next employee and he has his name in objEmp.lname and eventually I'll have to print off all the data in another function for all of them together. Like Employee #1 Name, LName Employee #2 Name, LName. Etc...
