Ask Question
31 August, 05:33

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. 31 August, 08:02
    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?
Find 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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers