gpt4 book ai didi

C++ 平方函数

转载 作者:行者123 更新时间:2023-11-30 02:01:07 25 4
gpt4 key购买 nike

当我编译我的程序时,它似乎没有执行我的公式,我不知道我做错了什么帮助将不胜感激

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com