单选题 1分

有如下程序:    #include < iostream>    #include&n...

有如下程序:
    #include < iostream>
    #include <cmath>
    using namespace std;
    class Power{ //幂类
        double base; //底数
        double expo; //指数
    public:
        Power(double v, double p):base(v),expo(p){}
        double getBase()const{ return base; }
        double getExponent()const{ return expo; }
    };
    class Square:public Power{
    public:
        Square(double x):Power(x,2.0){}
    };
    class Cubic:public Power{
    public:
        Cubic(double x):Power(x,3.0){}
    };
    ostream & operator <<(ostream&os,const Power&p){
        os<<pow(_____________________________);
        return os;
    }
    int main(){
        cout<<Square(3)<<Cubic(5);
        return 0;
    }
    运行后的输出结果是9125,则下划线处缺失的部分是(  )。
  • A. p.base,p.expo
  • B. p.expo,p.base
  • C. p.getBase(),p.getExponent()
  • D. p.getExponent(),p.getBase()

你可能感兴趣的试题

1 单选题 1分
  • A. 算法的时间复杂度与算法程序中的语句条数成正比
  • B. 算法的时间复杂度与计算机的运行速度有关
  • C. 算法的时间复杂度与运行算法时特定的输入有关
  • D. 算法的时间复杂度与算法程序编制者的水平有关
2 单选题 1分
  • A. 希尔排序
  • B. 快速排序
  • C. 堆排序
  • D. 冒泡排序
5 单选题 1分
  • A. 递归、迭代和回溯
  • B. 过程、函数和子程序
  • C. 顺序、选择和循环
  • D. 调用、返回和选择