下列程序运行结果是 。 class Student { int score ; static int count ; public : Student (int n=0) { score =n ; count++ ; } Student (Student &p) { score =p. score ; count++ ;} ~Student () { cout<<"the number of the students: endl; } void showscore()> < <endl; } static int getcount(){ return count="0" ; student fun(student p0) { p1="p0;" number of the students: endl p1; :: void main() john(80) cout "the score john: "; john.showscore(); tom; tom="fun(John);" tom: tom.showscore(>
第1题
#include
class A
{
int a;
public:
A(){a=0;}
A(int as)
{
a=as;
cout<
}
};
void main()
{
Ax,y(2),z(3);
cout<
}
A.1
B.2
C.3
D.4
第2题
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的学费
}
第3题
下列程序运行结果是 。 class CTest { private: static int count; public: CTest(){++count;} ~CTest(){cout<<--count<<"object exist\n";} static int getcount(){return count;} }; ctest::count="0;" void main() {> <<"object exist\n"; ctest test1; *ptest2; ptest2="new" ctest;> getCount()<<"object exist\n"; delete ptest2;> <<"object exist\n"; }>
第4题
A.4
B.17
C.18
D.0.25
第5题
A.*** a=2
B.*** a=3
C.### b=2
D.### b=3
第6题
A.0
B.23
C.34
D.25
第7题
class Father{
int m.n;
Father(int a,int B)
{ m=a;
n=b
}
void show ( ){
System.out.println("m and n:"+m+" "+n);
}
}
class Son extends Father{
int p;
Son (int a,int b,int C)
{ super(a,B) ;
p=c;
}
void show(){supur.show( );
System.out.println("p:"+p);
}
}
class Test {
public static void main (String args[ ])
{ Son s:new Son(6,7,8);
s.show( );
}
}
A.m and n:6 8 p:7
B.m andn:6 7 p:8
C.m and n:7 8 p:6
D.m and n:8 7 p:6
第8题
A.6 6
B.5 8
C.13 21
D.34 55
第9题
A.0
B.23
C.34
D.25
第10题
A.5 0 6 4
B.0 0 6 4
C.5 0 6 2
D.0 0 6 2
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!