网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
下面程序的输出结果是【】。include include class point{double x; double y;

下面程序的输出结果是【 】。

include <iostream.h>

include <math.h>

class point

{

double x;

double y;

public:

point(double a, double b)

{

x=a;

y=b;

}

friend double distance(point a, point b) ;

};

double distance(point a, point b)

{

return sqrt ((a. x-b.x) * (a. x-b.x)+ (a. y-b. y) * (a. y-b. y) );

}

void main()

{

point p1(1,2);

point p2(5,2);

cout<<distance(p1,p2)<<end1;

}


参考答案

更多 “ 下面程序的输出结果是【】。include include class point{double x; double y; 下面程序的输出结果是【 】。include <iostream.h>include <math.h>class point{double x;double y;public:point(double a, double b){x=a;y=b;}friend double distance(point a, point b) ;};double distance(point a, point b){return sqrt ((a. x-b.x) * (a. x-b.x)+ (a. y-b. y) * (a. y-b. y) );}void main(){point p1(1,2);point p2(5,2);cout<<distance(p1,p2)<<end1;} ” 相关考题
考题 下面程序的输出结果是【】。define MIN(a,b) (((a)void main(){int 下面程序的输出结果是【 】。define MIN(a,b) (((a)<(b))?a:b)include <iostream.h>void main(){int x= 3, y=5;cout<< MIN(x,y)<<end1;}

考题 下面程序的输出结果是()。includeincludeusing namespace std;class point{p 下面程序的输出结果是( )。 #include<iostream> #include<math.h> using namespace std; class point { private: double x; double y; public: point(double a,double b) { x=a; y=b; } friend double distances(point a,point b); }; double distances(point a,point b) { return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); } int main() { point p1(1,2); point p2(5,2); cout<<distances(p1,p2)<<end1; return 0; }A.2B.4C.8D.16

考题 下面程序的输出结果是 ______。includevoidmain(){intx=20;inty=x;cout 下面程序的输出结果是 ______。 #include<iostream.h> void main(){ int x=20; int y=x; cout<<(x==y)<<“”; cout<<(x==y)<<end1: }A.20 20 20 20B.20 20C.1 1D.出错

考题 下列程序的执行结果为【 】。include class Point{public:Point(double i, double j) 下列程序的执行结果为【 】。include <iostream. h>class Point{public:Point(double i, double j) { x=i; y=j;}double Area() const { return 0.0;}private:double x, y;};class Rectangle: public Point{public:Rectangle(double i, double j, double k, double 1)double Area() const {return w * h;}private:double w, h;};Rectangle: :Rectangle(double i, double j, double k. double 1): Point(i,j).{w=k, h=1}void fun(Point s){cout<<s. Area()<<end1;}void main( ){Rectangle rec(3.0, 5.2, 15.0. 25.0);fun(rec)}

考题 以下程序的运行结果是______。 include include template class TA 以下程序的运行结果是______。include<iostream.h>include<math.h>template<class T>class TAdd//定义类模板TAdd,T为类型{Tx,y;public:TAdd (Ta,Tb) {x=a,y=b;) //构造函数Tadd() { retum x+y;}//成员函数};void main( ){TAdd<int>A (5,6);

考题 有以下程序:includeincludeusing namespace std; class point{private:double 有以下程序: #include<iostream> #include<math> using namespace std; class point { private: double x; double y; public: point(double a,double B) { x=a; y=b; } friend double distance (point a,point B) ;A.1B.5C.4D.6

考题 下面程序的输出结果是【】。includeint add(int a, int b);void main(){extern int x, 下面程序的输出结果是【 】。include<iostream.h>int add(int a, int b);void main(){extern int x, y;cout<<add(x, y)<<end1;}int x(20),y(5);int add(int a, int b){int s=a+ b;return s;}

考题 下面程序的输出结果是()。includevoid main(){int x=-1,y=5,z;z=(x++ 下面程序的输出结果是( )。#include<iostream.h>void main(){int x=-1,y=5,z;z=(x++<0) (y-->=0);cout<<x<<'\t'<<y<<'\t'<<z<<end1;}A.-1 5 0B.-1 4 1C.0 4 1D.0 4 0

考题 10、下面程序执行后的输出结果是()。 #include <stdio.h> #define DOUBLE(r) r*r int main() { int x=1,y=2,t; t = DOUBLE(x+y); printf("%d",t); return 0; }A.5B.6C.7D.8