It is often useful to have only one thread execute some of the code in a parallel region. I/O statements are a common example
#pragma omp parallel
{
#pragma omp master
{
int id = omp_get_thread_num();
cout << "My thread num" << id << endl;
}
}