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

题目内容 (请给出正确答案)
有以下程序:include include using namespace std;class point{private:doubl

有以下程序:#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 ; };double distance(point a, point b return sqrt((a. x-b. x )*(a. x -b. x )+ (a. x -b. x)*(a. x-b. x));}int main (){ point p1 (1,2); point p2(5,2); cout<<distance (p1, p2)<<end1; return 0;} 程序运行后的输出结果是

A.1

B.5

C.4

D.6


参考答案

更多 “ 有以下程序:include include using namespace std;class point{private:doubl 有以下程序:#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 ; };double distance(point a, point b return sqrt((a. x-b. x )*(a. x -b. x )+ (a. x -b. x)*(a. x-b. x));}int main (){ point p1 (1,2); point p2(5,2); cout<<distance (p1, p2)<<end1; return 0;} 程序运行后的输出结果是A.1B.5C.4D.6 ” 相关考题
考题 有以下程序:includeusingnamespacestd;definePI3.14classPoint{private: intx,y;pub 有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int b) { x=a; y=b; } int getx() { return x; } int gety() { return y; } }; class Circle : public Point { private: int r; public: Circle(int a,int b,int c):Point(a,b) { r=c; } int getr() { return r; } double area() { return PI*r*r; } }; int main() { Circle c1(5,7,10); cout<<cl.area()<<endl; return 0; } 程序执行后的输出结果是A.314B.157C.78.5D.153.86

考题 有以下程序:includeusing namespace std;class sample{private:int x;public:sample( 有以下程序: #include<iostream> using namespace std; class sample { private: int x; public: sample(int A) { x=a; friend double square(sample s); }; double square(sample s) { return S.X*S.K; } int main() { saA.20B.30C.900D.400

考题 有以下程序:includeusing namespace std;definePl 3.14Class Point{private:int x,y 有以下程序: #include<iostream> using namespace std; #definePl 3.14 Class Point {private: int x,y; public: Point(int a,intB) {X=a; y:b;} int getx() <return x;} int gety() {return y;}}; class Circle:public Point {priA.314B.157C.78.5D.153.86

考题 有以下程序:include include using namespace std;class base{private: cha 有以下程序: #include <iostream> #include <string> using namespace std; class base { private: char baseName[10]; public: base ( ) { strcpy (baseName, "Base"); } virtual char *myName() {A.DerivedBaseB.BaseBaseC.DerivedDerivedD.BaseDerived

考题 有以下程序: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

考题 有以下程序:includeusing namespace std;class BASE{private: char c;public: BASE(c 有以下程序: #include <iostream> using namespace std; class BASE { private: char c; public: BASE(char n):c(n);{} virtual~BASE() { cout<<c; } }; class DERIVED:public BASE { char c; pA.XYB.YXC.XD.Y

考题 有以下程序:include include using namespace std;class point{private: doub 有以下程序: #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) ; }; double distance(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 pl(1,2); point p2 (5, 2); cout<<distance (pl,p2) <<end1; return 0; } 程序运行后的输出结果是( )。A.1B.5C.4D.6

考题 有以下程序:include using namespace std;define PI 3.14class Point{ private:int 有以下程序: #include <iostream> using namespace std; #define PI 3.14 class Point { private: int x,y; public: Point(int a,int b) { x=a; y=b; } int getx() { return x; }A.314B.157C.78.5D.153.86

考题 若有以下程序:include using namespace std;class point{private: int x, y;public: 若有以下程序: #include <iostream> using namespace std; class point { private: int x, y; public: point ( ) { x=0; y=0; } void setpoint(int x1,int y1) { x=x1; y=y1;A.12,12B.5,5C.12,5D.5,12