#include #include #include #define NUMTHREADs 2 using namespace std; int main() { stringstream ss[100]; int nprocs; #pragma omp parallel { #pragma omp sections { #pragma omp section { int total_threads = omp_get_num_threads(); int myid = omp_get_thread_num(); nprocs = total_threads; ss[myid] << "I am the first section. Myid = " << myid; } #pragma omp section { int total_threads = omp_get_num_threads(); int myid = omp_get_thread_num(); ss[myid] << "I am the second section. Myid = " << myid; } } } for (int i=0; i> a) cout << a << " "; cout << "\n"; } return 0; }