C++ 平方函数

标签 c++ function 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;
 }

最佳答案

改变距离,Xvalue 和 Yvalue 成双

关于C++ 平方函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14471096/

相关文章:

sympy - 在 Sympy 中定义符号的范围

c++ - 计算 1 - 小参数 x (~10^-12) 的 sqrt(x) 类似于 expm1(在 C/C++ 中)

c++ - QWebElement 在单独的线程中操作 QWebPage

c++ - 警告 RC4011 : identifier truncated to

c++ - C++ 中的字符串验证

javascript - 独立的事件处理程序以实现可重用性

c++ - glActiveTexutre 和 GL_TEXTURE0 不起作用,都是未声明的标识符

python - 为什么在 Python 中不允许使用 foo(*arg, x)?

c - c 中带有 double 的函数有不同的语法吗?

c++ - C++ 中的五角大楼项目