有如下程序: include using namespace std; class Wages{//“工资”类 double base; // 有如下程序:include<iostream>using namespace std;class Wages{ //“工资”类double base; //基本工资double bonus; //奖金double tax; //税金public:Wages(double CBase,double CBonus,double CTax):base(CBase),bonus(CBonus),tax(CTax){}double getPay()const; //返回应付工资额Wages operator+(Wages w)const; //重载加法};double Wages::getPay()const{return base+bonus-tax;}Wages Wages::operator+(Wages W)const{return Wages(base+w.base,bonus+w.bonus,tax+w.tax);}int main(){Wages w1(2000,500,100),w2(5000,1000,300);cout<<(w1+w2).getPay0<<end1;return 0;}程序的输出结果是
有如下程序: include using namespace std; class Wages{//“工资”类 double base; //
有如下程序:
include<iostream>
using namespace std;
class Wages{ //“工资”类
double base; //基本工资
double bonus; //奖金
double tax; //税金
public:
Wages(double CBase,double CBonus,double CTax):
base(CBase),bonus(CBonus),tax(CTax){}
double getPay()const; //返回应付工资额
Wages operator+(Wages w)const; //重载加法
};
double Wages::getPay()const{return base+bonus-tax;}
Wages Wages::operator+(Wages W)const{
return Wages(base+w.base,bonus+w.bonus,tax+w.tax);
}
int main(){
Wages w1(2000,500,100),w2(5000,1000,300);
cout<<(w1+w2).getPay0<<end1;
return 0;
}
程序的输出结果是
相关考题:
如下程序的输出结果是______。 include using namespace std; class Wages{//“工资” 如下程序的输出结果是______。include<iostream>using namespace std;class Wages{ //“工资”类double base; //基本工资double bonus; //奖金double tax; //税金public:Wages(double CBase,double CBonus,doable CTax):base(CBase),bonus(CBonus),tax(CTax){ }double getPay( )const; //返回应付工资额Wages operator+(Wages w)cons[; //重载加法};double Wages::getPay( )cons[{return base+bonus-tax;}Wages Wages::operator+(Wages w)const{return Wages(base+w.base,bonus+w.bonus,tax+w.tax);}int main( ){Wages wl(2000,500,100),w2(5000,1000,300);eout<<(wl+w2).getPay( )<<endl;return 0;}
有如下程序:includeusing namespace std;class Base{protected:Base(){cout 有如下程序: #include<iostream> using namespace std; class Base{ protected: Base(){cout<<'Base';} Base(char c){cout<<c;} }; class Derived:public Base{ public: Derived(char c){cout<<c;} }; int main(){ Derived d('Derived'); return 0; } 执行这个程序屏幕上将显示输出( )。A.DerivedB.DerivedBaseC.BaseDerivedD.DerivedDerived
有如下程序:include using namespace std;class BASE{public:~BASE(){cout 有如下程序: #include <iostream> using namespace std; class BASE{ public: ~BASE(){cout<<"BASE";} }; class DERIVED:public BASE{ public: ~DERIVED(){cout<<"DERIVED";} }; int main(){DERIVED x;return 0;} 执行后的输出结果是A.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE
有如下程序:includeusing namespace std;class BASE{public:~BASE( ){cout 有如下程序: #include<iostream> using namespace std; class BASE{ public: ~BASE( ){cout<<"BASE";} }; class DERIVED:public BASE{ public: ~DERIVED( ){cout<<"DERIVED";} }; int main( ){DERIVED x;return 0;} 程序的输出结果是A.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE
有如下程序:includeincludeusing namespace std;class BASE{char c;public 有如下程序: #include<iostream>#include<iosream> using namespace std; class BASE{ char c; public; BASE(char n):c(n){} virtual ~ BASE(){cout<<c;} }; class DERIVED; public BASE{ char c; public: DERIVED (char n): BASE (n+1)A.XYB.YXC.XD.Y
有以下程序: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
有如下程序:include using namespace std;class BASE{public:~BASE() {cout 有如下程序: #include <iostream> using namespace std; class BASE{ public: ~BASE() {cout<<"BASE"; } }; class DERIVED: public BASE { public: ~DERIVED() {cout<;"DERIVED"; } }; int main(){DERIVED x; return 0;} 执行后的输出结果是______ 。A.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE
有如下程序includeusing namespace std;class Base{protected:Base(){cout 有如下程序 #include<iostream> using namespace std; class Base{ protected: Base(){cout<<'A';} Base(char c){cout<<c;) }; class Derived: public Base{ public: Derived(char c){cout<<c;) }; int main(){ Derived dl('B'); return 0; } 执行这个程序屏幕上将显示输出( )。A.BB.BAC.ABD.BB
有如下程序:includeusing namespace std;class BASE{public:~BASE(){cout 有如下程序: #include<iostream> using namespace std; class BASE{ public: ~BASE(){cout<<"BASE";} }; class DERIVED:public BASE{ public: ~DERIVED(){cout<<"DERIVED";} }; int main(){DERIVED x;return 0;} 执行后的输出结果是( )。A.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE