网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
下列程序的执行结果是______。 include class Student { public: Student(int xx){x=
下列程序的执行结果是______。
include<iostream.h>
class Student
{
public:
Student(int xx){x=xx;}
virtual float calcTuition( );
protected:
int x;
};
float Studertt::calcTuition( )
{
return float(x*x);
}
class GraduateStudent:public Student
{
public:
GraduateStudent(int xx):Student(xx){}
float calcTuition( );
};
float Graduatestudent::calcTuition( )
{
return float(x*2);
}
void main( )
{
Student s(20);
GraduateStudent gs(30);
cout<<s.calcTuition( )<<" "<<gs.calcTuition( )<<endl;
//计算学生s和研究生gs的学费
}
参考答案
更多 “ 下列程序的执行结果是______。 include class Student { public: Student(int xx){x= 下列程序的执行结果是______。include<iostream.h>class Student{public:Student(int xx){x=xx;}virtual float calcTuition( );protected:int x;};float Studertt::calcTuition( ){return float(x*x);}class GraduateStudent:public Student{public:GraduateStudent(int xx):Student(xx){}float calcTuition( );};float Graduatestudent::calcTuition( ){return float(x*2);}void main( ){Student s(20);GraduateStudent gs(30);cout<<s.calcTuition( )<<" "<<gs.calcTuition( )<<endl;//计算学生s和研究生gs的学费} ” 相关考题
考题
以下程序的执行结果是【】。includeincludeclass Sample{ public: int x,y;
以下程序的执行结果是【 】。include<iostream.h>include<stdlib.h>class Sample{public:int x,y;Sample(){x=y=0;}Sample(int a,int b) {x=a;y=b; }void disp(){cout<<"x="<<x<<",y="<<y<<end1;}};void main() {Sample s1(2,3);s1.disp();}
考题
下列程序的运行结果是 includeclass Location{private:int X.Y;public:void init(i
下列程序的运行结果是 #include<iostream.h> class Location{ private: int X.Y; public: void init(int=0,int=0); void valueX(int val){X=val;} int valueX( ){ return X;} void valueYA.5 0 6 4B.0 0 6 4C.5 0 6 2D.0 0 6 2
考题
以下程序的执行结果是______。 include class A{ int a: public: void seta(int x) {
以下程序的执行结果是______。include<iostream.h>class A{int a:public:void seta(int x) {a=x;}void showa() {cout<<a<<end1;}};class B{int b;public:void setb(int x) {b=x;}void showb(){cout<<b<<end1;}};
考题
有以下程序: include class A { intx; public: A(int a) { x=a;} friend class B;
有以下程序:include<iostream.h>class A{int x;public:A(int a){x=a;}friend class B;}class B{public:void print(A a){a. x--;cout<<a.x<<end1;}};void main(){A a(10);B b;b.print(a) ;}程序执行后的输出结果是【 】。
考题
下列程序的执行结果是()。includeincludeclass TestClass{public:intx,y
下列程序的执行结果是( )。 #include<iostream.h> #include<stdlib.h> class TestClass { public: intx,y; TestClass(){x=y=0;} TestClass(int a,int b){x=a;y=b;} void disp() { cout<<"X"="<<X<<",y="<<y<<endl; }A.x=2,y=2B.x=3,y=3C.x=2,y=3D.x=3,y=2
考题
使用VC6打开考生文件夹下的工程test35_1,此工程包含一个源程序文件test35_1.cpp,但该程序运行有问题,请改正程序中的错误,使该程序的输出结果为:40040源程序文件test35_1.cpp清单如下:include <iostream.h>class Student{public:Student(int xx){x=xx;}virtual float calcTuition();/***************** found *****************/private:int x;};float Student::calcTuition(){return float(x'x);}/***************** found *****************/class GraduateStudent::public Student{public:/***************** found *****************/GraduateStudent(int xx) ::Student(xx){}virtual float calcTuition();};float GraduateStudent::calcTuition(){return float(x*2);}void main(){Student s(20);GraduateStudent gs(20);cout<<s.calcTuition()<<end1;cout<<gs.calcTuition()<<end1;}
考题
下列程序的运行结果是______。 include class Base { public: virtual void func(int
下列程序的运行结果是______。include<iostream.h>class Base{public:virtual void func(int i){cout<<"class Base:"<<i<<end1;)};class Derived: public Base{public:void func(double d){cout<<"class Derived:"<<d<<endl;}};void main( ){Base a,*p=a;Derived b;p=b;(*p).func(3.3);}
考题
00330038003000301585067361821下列程序段执行结果是___________。 x = 1 print(type(x)) x = 1.0 print(type(x)) x = '1.0' print(type(x)A.<class 'int'> <class 'float'> <class 'str'>B.<class 'float'> <class 'int'> <class 'str'>C.<class 'str'> <class 'float'> <class 'int'>D.<class 'str'> <class 'int'> <class 'float'>
考题
下列程序段执行结果是___________。 x = 1 print(type(x)) x = 1.0 print(type(x)) x = '1.0' print(type(x)A.<class 'int'> <class 'float'> <class 'str'>B.<class 'float'> <class 'int'> <class 'str'>C.<class 'str'> <class 'float'> <class 'int'>D.<class 'str'> <class 'int'> <class 'float'>
热门标签
最新试卷