Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <stdio.h>
  3. #include <windows.h>
  4. #include <iostream>
  5. #include <omp.h>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     setlocale(LC_ALL, "Russian");
  12.     omp_set_num_threads(8);
  13.     int i = 0;
  14.    
  15.     #pragma omp parallel reduction (+: i)
  16.     {
  17.         i++;
  18.         printf("Thread %i ", omp_get_thread_num(), ".\n");
  19.         cout << "Hello World!\n";
  20.  
  21.     }
  22.     cout << "Кол-во пот потоков: " << i << endl;
  23.  
  24.     system("pause");
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement