while(r<=0); //this is the error, it should be (r>0)
p=2*P*r;
s=P*r^2;
cout<<"The perimeter is : " <<p<<endl;
cout<<"The area is : " <<s<<endl;
system ("pause");
return 0;
}
you were taking the criteria so that it would work only when the radius is less than 0 or 0, try it that way
You shouldn't use pow() to calculate the square (or, for that matter, any integer exponent). It most certainly is pretty slow and it is inexact (no guarantee whatsoever about the result, as opposed to (d*d) which will be the exact value of the multiplication rounded to the nearest existing double value).