Question: C++ Write a program in which: 1. There is a global n-element array (maximum 50) of numbers of type int. 2. An additional thread generates

C++
Write a program in which:
1. There is a global n-element array (maximum 50) of numbers of type int.
2. An additional thread generates numbers and inserts them into an array.
3. The main thread displays generated numbers.
Additional thread code should be placed in the class. The class constructor receives by the parameter value of n (how many numbers to generate). Since the main thread must wait for the data - for synchronization use: appropriate lock, a global conditional variable and a global logical flag (variable of type bool).

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!