Question
1. Read the structure of the lines in the attached file that has the information of an employee. The file will be expanded to future
1. Read the structure of the lines in the attached file that has the information of an employee. The file will be expanded to future projects.
2. Define a struct data type named Employee that has employee code, social security number, first name, last name, department name, role, and salary. The employee code, S, indicates a salaried employee.
3. Use an array of Employee type to store the information of the employees.
I can't figure out if we are supposed to be reading the file in or putting it into an individual structure. I have included the text files and pictures of what I have so far on both ways of doing the coding on it.
hann employee - Notepad File Edit Format View Help $ 135-25-1234 Sophia Smith 135-67-5462 Jacob Johnaon 252-34-6728 Emma William 237-12-1289 Mason Miller S 581-23-4536 Jayden Jones 501-56-9724 Mia Rogers 408-67-8234 Choloe Cook 516-34-6524 Daniel Morris 526-47-2435 Natalie Smit 530-46-8245 Grace Johnson 035-35-6472 Avery Allen S 222-35-9324 Joshua Youn S 407-36-1285 Elijah Hall 251-98-2836 Davia Wright S 627-67-9879 Andrew Rogers 509-45-0909 Joshua Park S 408-12-8976 Stewart Thomson S 425-90-2010 Sanjeev Sharma 433-44-2324 Sandra Sellters 486-88-9981 Dennis Arthur S 478-77-2763 Daniel Weaver S 505-55-8786 Amanda Byron S 429-30-3678 Megan Finley DevOps Developer SecOps Pentester DevOps DBExpert DevOps CloudArchitect SecOps Pentester DevOps Auditor DevOps QAEngineer DevOps ProductOwner DevOps Developer Secops SecurityEngineer DevOps Technical Lead DevOps ScrumMaster DevOps QAEngineer Devops CloudArchitect Devops SystemAdmin SecOps SecurityArchitect DevOps Deployment Engineer DevOps Worldwide Lead AccountFinance AccountingManager AccountFinance Accountant Sales SalesManager Sales SalesAssociate Administration OfficeManager 70000 130000 100000 80000 250000 90000 100000 300000 130000 300000 250000 150000 100000 200000 100000 250000 250000 350000 200000 60000 70000 70000 80000 Estruct Employee! string role; string first; string last; int salary; int social; char employee_code;|| string department; void read file() //read file into an array Om Tino 0 Nm ifstream data ("/users/chelsea/desktop/employee.txt"); Employee array(1000] if(! data.fail() DI int i; for(int i=0; i>array[i] employee_code >>array[i].social >>array[i].first >>array[i].last >>array[i].department >>array[i].role >>array[i].salary; 0 0 ON for (int i=0; i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started