Question
C++ You are to write a program that will help Santa process the work done by his elves. You will be using a data file
C++
You are to write a program that will help Santa process the work done by his elves. You will be using a data file called elves.dat . There will be one line for each elf. That line will contain the name of the elf and the number of toys the elf made. You are to read from the file and place the values in parallel arrays. You do not know how many elves there are so you must read until the end of file and count. You will need a third parallel array of strings to record a rating for each elf. You should declare arrays with the capacity for 50 components.
The program should read into the arrays. It should look at the number of toys made by each elf and record a rating in a parallel array. The table below determines the ratings. The program should then print out the arrays side by side in neat, labeled columns. It should print out the total number of toys made by the elves, the number of elves who made more than 500 toys, the name of the elf who made the most toys, and the name of the elf who made the least toys. Each calculation should have a function of its own. NO output should be done in functions that do calculations. All output should be done in one output function. Remember to always pass the number of elements in the array with the array to functions.
The data file can be found at /export/home/public/ddemarco/csc135/elves.dat . Use the following command to copy this file to your directory:
cp /export/home/public/ddemarco/csc135/elves.dat elves.dat
Toys Made Rating 500 or more ***** between 300 and 499 *** between 200 and 299 * under 200 -
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