'AfxBeginThread': none of the 2 overloads can convert parameter 1 from type 'unsigned int (void *)
intn=0;UINTCalculateprime(LPVOIDpParam){n=0;longm,k,i;for(m=1;m<=1000000;m=m+2){k=(lo...
int n=0;
UINT Calculateprime(LPVOID pParam)
{
n=0;
long m,k,i;
for(m=1;m<=1000000;m=m+2)
{
k=(long)sqrt(m);
for(i=2;i<=k;i++)
if(m%i==0)break;
if(i>=k+1)n=n+1;
}
// return 0;
}
void CLi10_2View::OnPrime()
{
// TODO: Add your command handler code here
AfxBeginThread(Calculateprime,(LPVOID)n,THREAD_PRIORITY_BELOW_NORMAL,0);
CString str;
str.Format("The Prime Numbers from 1 to 1000000 is %d.",n);
AfxMessageBox(str);
} 展开
UINT Calculateprime(LPVOID pParam)
{
n=0;
long m,k,i;
for(m=1;m<=1000000;m=m+2)
{
k=(long)sqrt(m);
for(i=2;i<=k;i++)
if(m%i==0)break;
if(i>=k+1)n=n+1;
}
// return 0;
}
void CLi10_2View::OnPrime()
{
// TODO: Add your command handler code here
AfxBeginThread(Calculateprime,(LPVOID)n,THREAD_PRIORITY_BELOW_NORMAL,0);
CString str;
str.Format("The Prime Numbers from 1 to 1000000 is %d.",n);
AfxMessageBox(str);
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询