Advertisement
Tvor0zhok

ParProg2.7

Feb 18th, 2023
645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <omp.h>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     setlocale(LC_ALL, "Russian");
  10.  
  11.     vector<int> arr(10);
  12.  
  13. #pragma omp parallel shared(arr)
  14.     {
  15.         arr[omp_get_thread_num()] = omp_get_thread_num();
  16.     }
  17.  
  18.     for (int i = 0; i < arr.size(); ++i)
  19.         cout << arr[i] << " ";
  20.  
  21.     return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement