gpt4 book ai didi

c++ - 两点距离的解是什么?

转载 作者:行者123 更新时间:2023-11-28 00:18:14 24 4
gpt4 key购买 nike

<分区>

问题是关于计算两点之间的距离,当我运行程序时我得到这个错误信息:

Run-Time Check Failure #3 - The variable y2 is being used without being initialized.

代码:

#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main()
{
double x1,y1,x2,y2;
cin >> x1,y1;
cin >> x2,y2;
cout << fixed << setprecision(4) << pow((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1),0.5);

return 0;
};

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