[单选题]

若有以下程序:include using namespace std;define PI 3.14class Point{private: in

若有以下程序: #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<<c1.area()<<end1; return 0; } 程序执行后的输出结果是( )。

A.314

B.157

C.78.5

D.153.86

参考答案与解析:

相关试题

若有以下程序: include using namespace std; cl

[主观题]若有以下程序: include using namespace std; class sample { int x; public: sample若有以下程序:include <iostream>using namespace std;class sample{int x;public:sample(){}void setx(int i){x=i;}friend iht fun(sample B[],int n){int m=0;for{int i=0;i<n;i++)if(B[i].x>m)

  • 查看答案
  • 若有以下程序:#include using namespace std;int

    [单选题]若有以下程序:include using namespace std;int f(){static int i = 0;int s = 1;s£«=若有以下程序: #include <iostream> using namespace std; int f() { static int i = 0; int s = 1; s+=i; i++; return s; } int main() { int i,a = 0; for(i = 0;i<5;i++) a+=f(); cout<<a<<end

  • 查看答案
  • 若有以下程序#include using namespace std;class

    [单选题]若有以下程序include using namespace std;class A{public: A(int i,int j) {a=i;b=j若有以下程序 #include <iostream> using namespace std; class A { public: A(int i,int j) { a=i; b=j; } void move(int x, int y) { a+=x; b+=y; } void show() { cout < <a < <" , " <<b<< e

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class Base {public:Base() { x=0; } int若有以下程序: #include <iostream> using namespace std; class Base { public: Base() { x=0; } int x; }; class Derivedl: virtual public Base { public: Derivedl() { x=10; } }; class Deriv

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class A{private: int a;public: A(int i若有以下程序: #include <iostream> using namespace std; class A { private: int a; public: A(int i) { a=i; } void disp() { cout<<a<<", "; } }; class B { private: int b; public: B(int

  • 查看答案
  • 若有以下程序:# include using namespace std;cla

    [单选题]若有以下程序: include using namespace std;class Base{public:Base ( ){x=0;}int x若有以下程序:# include <iostream>using namespace std;class Base{public: Base ( ) { x=0; } int x;};class Derived1 : virtual public Base{public: Derived1 ( ) { x=10; }}; class Derived2

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class Base{public:Base (){x=0;}int x;}若有以下程序: #include <iostream> using namespace std; class Base { public: Base () { x=0; } int x; }; class Derived1 : virtual public Base { public: Derived1 () { x=10; } }; class De

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class A{private:int a;public:A(int i){若有以下程序: #include <iostream> using namespace std; class A { private: int a; public: A(int i) { a=i; } void disp () { cout<<a<<","; } }; class B { private: int b; public: B(int

  • 查看答案
  • 若有以下程序:#include using namespace std;clas

    [单选题]若有以下程序:include using namespace std;class A{public:A() { }A(int i){x1=i;}v若有以下程序: #include <iostream> using namespace std; class A { public: A() { } A(int i) { x1=i; } void dispa0 { cout<<"x1="<<x1<<","; } private: int x1; }; class B: public A { p

  • 查看答案
  • 若有以下程序:#include using namespace std;void

    [单选题]若有以下程序:include using namespace std;void sub(int x,int y, int *z){ *z = y£«若有以下程序: #include <iostream> using namespace std; void sub(int x,int y, int *z) { *z = y+x; } int main() { int a,b, c; sub (8,4,&a) ; sub (6, a, &b) ; sub(a,b,&c) ;

  • 查看答案
  • 若有以下程序:#include using namespace std;#def