**C++ program** with structures, array of structures, files, sorting, and format
ID: 3813002 • Letter: #
Question
**C++ program** with structures, array of structures, files, sorting, and formatting. Thank you!
**Must read in the file and output to a file**
Sample input file (employees.txt):
1000 George Washington 10000
2000 John Adams 15000
1212 Thomas Jefferson 34000
1313 Abraham Lincoln 45000
1515 Jimmy Carter 78000
1717 George Bush 80000
objectives: Work with structures, array of structures, files, sorting, and formatting ****DO NOT USE SSTREAM A company keeps its employee records in a file. Each line in the file includes a single employee record (id, first name, last name, salary). Write a C++ program that prints several reports of employee data You are asked to process the data in the file be storing each record in an array of structures. You may assume thatthe number of employees will never exceed 100. Your program must print two reports All employee records sorted by last name. All employee records sorted by salary. Find and print the total payroll. Hints: Write a function to load the arrayof structures (make sure the name is in the right format) Write a function to sort the array by last name. Write a function to sort the array by salary o Use the same swap function for both sort functions Write a function to printthe report. This function can be used for both reports. Write a function to calculate and return the total payroll.Explanation / Answer
.ent exc_pulse
exc_pulse:
la t0, time
la t1, x_q
la t2, light
lw t3, 0(t0) //Load time (t3)
lw t4, 0(t1) //Load x_q (t4)
lw t5, 0(t2) //Load lightweight (t5)
addi t6, t3, one //Increment time by one
sw t6, 0(t0)
addi t7,zero,10 //Time before lightchangage
blt t6, t7, ls //If time < ten - long skipout
move t3, zero //time = 0;
sw t3, 0(t0)
beq t4, zero, ls //If x_q == zero - long skipout
bne t5, zero, ss //If lightweight == one - short skipout
addi t5, zero, one //light == one
sw t5, 0(t2)
lui t8, LEDZ
addi t9, zero, a hundred thirty //Turn on some lights!
sb t9, 0(t8)
j ls
ss:
move t5, zero //light = zero
sw t5, 0(t2)
addi t9, zero, 65
sb t9, 0(t8) //Turn on/off lights!
move t4,zero //empty queue
sw t4, 0(t1)
ls:
.end exc_pulse
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.