Question: Write a Cor C++ program A6p4.c (or A6p4.cpp) that accepts one command line argument which is an integer n between 2 and 4 inclusive. Generate

 Write a Cor C++ program A6p4.c (or A6p4.cpp) that accepts one

Write a Cor C++ program A6p4.c (or A6p4.cpp) that accepts one command line argument which is an integer n between 2 and 4 inclusive. Generate 60 random integers between 1 and 99 inclusive and store them in a 5 by 12 two dimensional integer array (i.e.int a [5] [12]). Use pthread to create n threads to update all array numbers according the following rule: if a number is even increment it by one; if a number is odd decrement it by one. You should divide this update task among the n threads as evenly as possible. Print the array before the update and after the update separately as 5 by 12 two dimensional arrays. (35 points) (Note: if you do not use pthread to divide the update task among the threads, you will get zero points.)

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!