Ask Question
6 July, 17:28

Make a copy of the pthreads_skeleton. cpp program and name it pthreads_p2. cpp Modify the main function to implement a loop that reads 10 integers from the console (user input) and stores these numbers in a one-dimensional (1D) array (this code will go right after the comment that says ""Add code to perform any needed initialization or to process user input""). You should use a global array for this.

+4
Answers (1)
  1. 6 July, 20:33
    0
    The solution code is as follows:

    #include using namespace std; int main () { int myArray [10] = {}; int i; for (i = 0; i < 10; i++) { cout <<"Enter an integer: "; cin>> myArray[i]; } }

    Explanation:

    Firstly, we initialize a 10-elements array, myArray (Line 7) with no values.

    Next, we create a for-loop (Line 10). Within the loop, we prompt user to enter an integer and assign the input value to the current element of myArray (Line 12-13).
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Make a copy of the pthreads_skeleton. cpp program and name it pthreads_p2. cpp Modify the main function to implement a loop that reads 10 ...” in 📙 Engineering if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers