// bsp8.cpp : Sectionsaufteilung


#include "stdafx.h"

#include "math.h"  // sin
#include <windows.h>  // rand

#include <omp.h>

//using namespace System;

int _tmain(int argc, _TCHAR* argv[])
{
	const int MAX=400;
	
	int tid;
	

	omp_set_num_threads(MAX);
	int j,n;

     #pragma omp parallel sections private(tid,j,n) 
	 {
		#pragma omp section
		{
				tid = omp_get_thread_num();  
				printf("Section 1  id: %d   AnzThread: %d\n", tid, omp_get_num_threads());
				n = (int) (rand()/100000);
				for (j=0; j<(n); j++) double d = sin(33.44);
		}
		#pragma omp section
		{
				tid = omp_get_thread_num();  
				printf("Section 2  id: %d   AnzThread: %d\n", tid, omp_get_num_threads());
				n = (int) (rand()/100000);
				for (j=0; j<(n); j++) double d = sin(33.44);
		}
		#pragma omp section
		{
				tid = omp_get_thread_num();  
				printf("Section 3  id: %d   AnzThread: %d\n", tid, omp_get_num_threads());
				n = (int) (rand()/100000);
				for (j=0; j<(n); j++) double d = sin(33.44);
		}
		#pragma omp section
		{
				tid = omp_get_thread_num();  
				printf("Section 4  id: %d   AnzThread: %d\n", tid, omp_get_num_threads());
				n = (int) (rand()/100000);
				for (j=0; j<(n); j++) double d = sin(33.44);
		}
		#pragma omp section
		{
				tid = omp_get_thread_num();  
				printf("Section 5  id: %d   AnzThread: %d\n", tid, omp_get_num_threads());
				n = (int) (rand()/100000);
				for (j=0; j<(n); j++) double d = sin(33.44);
		}

	 }
	char ch[200];
	gets(ch);
	

	return 0;
}

