i created a structure such as below struct list { char empNum[6] char empName[30
ID: 3618311 • Letter: I
Question
i created a structure such as belowstruct list
{
char empNum[6]
char empName[30]
float Yr_Earnings
float Mn_Earnings
}
with this i need to read in a list of employees from a file called"employee.txt"
i need to do this with a function and im using
int ReadEmployees(list []); // returning the number ofemployees on the list and parameter is the structure
the names in the file look like this: ('?' are used to divide upthe parts of the name)
123456?John Smith?23000?2000
i need help with the contents of the function, i can't figure outhow to read in the names and how to properly step there through thestructure/arrays so that the contents are properly read and how toread the employee number, name first and last (as one or attachusing strcpy/strcat?) and then the final two numbers..
please help, thank you
Explanation / Answer
please rate - thanks note the changes to your structure #include #include using namespace std; struct list { char empNum[7]; char empName[30]; double Yr_Earnings; double Mn_Earnings; }; int ReadEmployees(list []); int main() {list emp[20]; int n; n=ReadEmployees(emp); for(int i=0;iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.