Question: This assignment will require students to use command line arguments. Students will utilize a number of threads to sum a number of integers. Each thread

This assignment will require students to use command line arguments. Students will utilize a number of threads to sum a number of integers. Each thread will sum the elements given to them, before the sums from the threads are totaled. Your program should:
Accept two arguments from the command line
First argument is the number of threads to create (20%)
Second argument file that contains a list of integers (20%)
The first element in the list is the number of preceding elements.
In example, 51020304050 would be a list of 5 elements with values 10-50.
Each thread will sum its portion of the list. This will be done globally. For example, if we have 5 elements and two threads, one thread will sum two elements and one will sum 3. Then the thread sums are totaled. (25%)
Display the total sum, utilizing both the standard display, as well as output.txt.(35%)
If output.txt does not exist, then your application should create it. If it does exist, then the file should be truncated and overwritten.
Can you please put the code in c++
 This assignment will require students to use command line arguments. Students

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!