bool Prime (constint st) {
for (int i=2; i<st; i++)
if (st%i==0){
returnfalse;
}
returntrue;
}
int main(){
int a;
cout<<"Type number, please!";
cin>>a;
(a<0)?(a=(-1)*a):(a=a);
if (a==0){a=a+5);
break;}
cout<<a<<endl;
bool b = Prime(a);
if (b==true){cout<<"Yes, it is a prime number";}
else {cout<<"No, it is not the prime number";}
return 0;
}
What I acutally want, is that in the case one types 0, the function Prime is not done.
p.s. as a it writes 5, but in the function "travels" the first a (a=0)???
How to prevent it?