早教吧作业答案频道 -->其他-->
C++struct两点间距离Inmathematics,thedistanceofapointwithcoordinates(x,y)fromtheoriginisthesquarerootofthesumofx-squaredandy-squared.AssumethatPointhasalreadybeendefinedasastructuredtypewithtwodoublefields,x
题目详情
C++ struct 两点间距离
In mathematics,the distance of a point with coordinates (x,y) from the origin is the square root of the sum of x-squared and y-squared.Assume that Point has already been defined as a structured type with two double fields,x and y,define a function getR that takes as an argument a value of type Point and returns the distance of that point from the origin (as described above).在数学中点(X,Y)到原点间的距离等于x平方加y平方的平方根.假设这个点已经被定义在一个struct 类型,并有两个double类型的变量X,Y属于其中.定义一个方程getR,此方程作为一个参数值类型Point 并且返回该点到原点的距离.
In mathematics,the distance of a point with coordinates (x,y) from the origin is the square root of the sum of x-squared and y-squared.Assume that Point has already been defined as a structured type with two double fields,x and y,define a function getR that takes as an argument a value of type Point and returns the distance of that point from the origin (as described above).在数学中点(X,Y)到原点间的距离等于x平方加y平方的平方根.假设这个点已经被定义在一个struct 类型,并有两个double类型的变量X,Y属于其中.定义一个方程getR,此方程作为一个参数值类型Point 并且返回该点到原点的距离.
▼优质解答
答案和解析
#include
#include
#include
using namespace std;
struct point {
\x05 double x; double y;
\x05 };
double getR(struct point p)
{
double d;
d=sqrt(p.x*p.x+p.y*p.y);
return d;
} \x05
int main( )
{
double d;
struct point data;
coutdata.x;
cin>>data.y;
d=getR(data);
cout
#include
#include
using namespace std;
struct point {
\x05 double x; double y;
\x05 };
double getR(struct point p)
{
double d;
d=sqrt(p.x*p.x+p.y*p.y);
return d;
} \x05
int main( )
{
double d;
struct point data;
coutdata.x;
cin>>data.y;
d=getR(data);
cout
看了 C++struct两点间距离...的网友还看了以下:
1.下列对欧姆定律表达式I=U/R的理解中正确的是A.U与R的比值是一个恒量B.导体的电阻一定时, 2020-04-08 …
要求带单位我想要初中物理的所有公式.而且要有单位 比如I=U/R I——电流——单位(A) U—— 2020-05-15 …
对于纯电阻电路:已知:I、U,求:R=P=已知:R、U,求:I=P=已知:I、R,求:U=P=已知 2020-06-12 …
物理中的定义式我们老师说定义式的左右两边无关,就像E=F/Q不能说E与F成正比,与Q成反比,E只与 2020-06-14 …
一台电动机的额定电压为U,电流为I,电阻为R,当它正常工作时,电动机的功率为什么不是U^2/R功率 2020-07-04 …
(1)I=U/R(2)W=I²RT(3)W=U²T/R(4)W=UIT(5)W=PT(6)P=UI 2020-07-18 …
由欧姆定律I=UR得U=IR,正确的理解是()A.R与I、U无关B.R一定时,U与I成正比C.I一定 2020-10-30 …
下列说正确的是()A.根据R=UI可知,R与U成正比,与I成反比B.R=UI是电阻的关系式,R与U、 2020-10-30 …
并联电路中再并入一个大电阻之后,耗损的功率是不是就大了,U,R,I到底是什么关系?功率=I乘R的平方 2020-11-28 …
我想问一下关于并联电阻的事?我想问一下1/R=1/R1+1/R2这个式子怎么推出来的?是因为在并联电 2020-12-28 …