新手c++的
#include<iostream>#include<cmath>
using namespace std;
int main()
{ int a;
cout<<"input a:";
cin>>a;
int prime (int);
if(prime(a))
cout<<a<<"is not a prime"<<endl;
else
cout<<a<<"is a prime"<<endl;
return 0;
}
int prime(int a)
{int i,m;
m=sqrt(a);
for(i=0;i<=m;i++)
if(a%i==0) break;
if(i>m)return 1;
else return 0;
}此解法有什么问题?