Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //watki
- for (int k = 0; k < i; k++)
- {
- tab[k][j] = k;
- if (thr_create(NULL, 0, suma, tab[k], 0, NULL) == 0)
- cout << "Utworzono watek " << endl;
- else
- cout << "Nie udalo sie utworzyc watku" << endl;
- }
- while (thr_join(0, NULL, NULL) == 0);
- double srednia = sum / i;
- cout << "Srednia: " << srednia << endl;
- }
- void * suma(void *arg)
- {
- int suma = 0;
- int *p = (int*)arg;
- for (int w = 0; w<j; w++){
- suma += p[w];
- }
- cout << "Wynik dla wiersza " << p[j] + 1 << endl;
- cout << suma << endl;
- sum += suma;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement