0
my program can't give right answer
#include<iostream> #include<math.h> using namespace std; int main() { float a,b,c,d,dist; cin>>a>>b>>c>>d; a=a-b; c=c-d; dist=sqrt(pow(a,2)) +(pow(c,2)); cout<<dist; }
2 Antworten
+ 3
Your pow(c,2) is outside the sqrt.
So you're doing sqrt( a * a ) + c * c instead of sqrt( a * a + c * c )
0
thanks bro