当我编译我的程序它似乎没有执行我的公式我不能图什么我做错了帮助,将不胜感激C++ sqrt函数
int main()
{
int distance, Xvalue, Yvalue;
double x1,y1,x2,y2;
cout << "\n Please enter X1 value: ";
cin >> x1;
cout << " Please enter X2 value: ";
cin >> x2;
cout << "\n Please enter Y1 value: ";
cin >> y1;
cout << " Please enter Y2 value: ";
cin >> y2;
Xvalue = (x1 - x2);
Yvalue = (y1 - y2);
distance = sqrt(Xvalue * Xvalue + Yvalue * Yvalue);
cout << "This is the distance between the two points" <<distance<<
cout << endl << endl;
system ("pause");
return 0;
}
执行它时会发生什么? –
对于初学者来说,你的配方是错误的。 – chris
其余的代码在哪里?那甚至不会编译 – alrikai