题目内容

程序改错填空4.原程序: #include using namespace std; class point{ private: float x; public: void f(float a){x=a;} void f(){x=0;} friend float max(point& a,point& b); }; float max(point& a,point& b){ return(a.x>b.x)? a.x:b.x; } int main(){ point a,b; a.f(2.2);b.f(3.3); cout<

查看答案
更多问题

程序改错填空3.原程序: #include using namespace std; class f{ private: int x=0,y=0; public: void f1(int a,int b){x=a;y=b;} void get(){cout<

程序改错填空2.原程序: #include using namespace std; class f{ private: int x,y; public: f1(){x=0;y=0;} print(){cout<

程序改错填空1.原程序: #include using namespace std; int main(){ int x=5,y=6;const int * p=&x; *p=y; cout<

程序完善填空:用友员函数计算两点之间的距离。 #include #include ______ using namespace std; class Point{ public: Point(double xi, double yi) { X = xi ; Y = yi ;} double GetX() { return X ; } double GetY() { return Y ; } ______ double Distance(Point & a, Point & b) ; private: double X, Y ; }; double Distance(Point ______ a, Point ______ b ){ double dx = a.X-b.X ; double dy = a.Y-b.Y ; return sqrt( dx * dx + dy * dy ) ; } int main(){ ______ p1(3.0,5.0), p2(4.0,6.0) ; double d = Distance(p1,p2) ; // 调用友员函数 cout << "This distance is " << d << endl ; return 0; }

答案查题题库