单选题关于在调用模板函数时模板实参的使用,下列表述正确的是( )。
单选题有以下程序:
#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()<<endl;
relurn 0;}
程序执行后的输出结果是______。
单选题有如下程序: using namespace std; class B{ public: B(int xx):x(xx){++count;x+=10;} virtual void show()const {cout<<count<<'_'<<x<<endl;} protected: static hat count; private: mt x: }; class D:public B{ public: D(int xx,int yy):B(xx),y(yy){++count;y+=100;} virtual void Show()const {cout<<count<<'_'<<y<<end1;} private: int y; }; int B::count=0; int main(){ B*ptr==new D(10,20); ptr->show(); delete ptr; return 0; } 运行时的输出结果是( )。
单选题已知类MyClass中有一个只需要一个double型参数的构造函数,且将运算符“-”重载为友元函数。若语句序列
MyClass x(4.2), y(6.5), z(0.0);
z=8.1-y;
y=x-2.8;
能够正常运行,运算符“operator-”应该在类中声明为______。
单选题下面关于虚函数的描述中正确的是______。
单选题一个教师讲授多门课程,一门课程由多个教师讲授。则实体教师和课程间的联系是
单选题一个栈的初始状态为空。现将元素1、2、3、4、5、A、B、C、D、E依次入栈,然后再依次出栈,则元素出栈的顺序是______。
单选题有如下程序: #include<iostream> using namespace std; class test private: int a; public: test()cout<<"constructor"<<endl; test(int a)cout<<a<<endl; test(const test cout<<"copy constructor"<<endl; ~test()cout<<"destructor"<<endl; ; int main() test A(3); return 0; 执行这个程序的输出结果是______。 A.3 B.constructor destructor C.copy constructor destructor D.3 destructor
单选题下面程序输出的结果为( )。 #include<iostream.h> void fun(int a,int b) int temp; temp=a; a=b; b=temp; void main() int m,n; m=1; n=2; fun(m,n); cout<<m<<""<<n<<end1;
单选题定义无符号整数为Uint,下面可以作为类Uint实例化值的是( )。
单选题如果在表达式++x/y中,“++”是作为友元函数重载的,“/”是作为成员函数重载的,则该表达式还可为( )。
单选题若在表达式y/x中,''/''是作为成员函数重载的运算符,则该表达式还可以表示为( )。
单选题若已定义int a[]={0,1,2,3,4,5,6,7,8,9},*p=a,i;其中0
单选题下列运算符中,在C++语言中不能重载的是
A. *
B. >=
C. ::
D. /
单选题在C++程序中,使用基本输入输出流需要包含的头文件是( )。 A.stdio.h B.stdafx.h C.iostream.h D.stream.h
单选题有如下程序:
#include<iostream>
using namespace std;
class Point{
public:
Point(int xx=0,int yy=0):x(xx),y(yy){}
void SetX(int xx){x=xx;}
void SetY(int yy){y=yy;}
private:
int x,y;
};
class Circle:Point{
public:
Circle(int r):radius(r){}
int GetRadius(){return radius;}
private:
void SetRadius(int r){radius=r;}
int radius;
};
int main(){
Circle c1(5);
c1.SetX(1); //①
c1.SetY(2); //②
c1.SetRadius(10); //③
cout<<c1.GetRadius(); //④
return 0;
}
在标注号码的语句行中不存在语法错误的是______。
单选题若执行下面的程序时,从键盘上输入3和4,则输出结果是 main( ) int a,b,s; cin>>a>>b; s=a; if(a<B)s=b; s=s*s; cout<<s<<endl;
单选题下列关于模板形参的描述中,错误的是______。
单选题有如下程序: #include <iostream> using namespace std; class Sample friend long fun(Sample s); public: Sample(long
单选题有如下程序: #include <iostream.h> #include <iomanip.h> using namespace std; class CSum { int x,y; public: CSum (int x0,int y0):x(x0),y(y0){} friend ostream return os; } }; int main () { CSum y(3,5); cout<<setfill('*')<<8; cout<<y; return 0; } 执行上面程序的输出是