- 192 名前:デフォルトの名無しさん [2007/11/09(金) 10:58:06 ]
- これでも値が違います なぜでしょうか
#include <iostream> #include <windows.h> #include <process.h> using namespace std; #define N 200 #define K 16 unsigned int su[K]; unsigned WINAPI f(void *p){ int n=(int)p; for(int i=0;i<n*n;i++)su[i%K]++;} main(){ int n; for(n=0;n<K;n++)su[n]=0; HANDLE hf[N]; for(n=0;n<N;n++){ hf[n]=(HANDLE)_beginthreadex(NULL, 0, f,(void*)n, 0 ,NULL);} end: WaitForMultipleObjects(N, hf, TRUE, INFINITE); for(n=0;n<K;n++)cout<<n<<" no kosu "<<su[n]<<endl;}
|

|