单选题有如下函数模板:templateT square(T x){return x*x;}其中T是( )。
单选题有如下程序:
#include<iostream>
void fun(intx=y;y=t;}
int main()
{
int a[2]={23,42};
fun(a[1],a[0]);
std::cout<<a[0]<<","<<a[1]<<std::endl;
return 0;
}
执行后的输出结果是______。
单选题关键字unsigned不能修饰的类型是( )。
单选题若MyClass为一个类,执行“MyClass a[4],*p[5];”语句时会自动调用该类构造函数的次数是______。
单选题有如下程序:#include <iostream>using namespace std;class point{ int x, y;public: point( int vx, int vy ) { X=vx; y=vy; } point() { x=0; y=0; } point operator+ ( point p1 ) { point p; int px = x + p1.x; int py = y+ p1.y; return point( px, py ); } point operator-( point p1 { point p; int px = x - p1.x; int py = y - p1.y; return point( px, py ); } void print() { cout<<x<<","<<y<<end1; }};int main(){ point p1( 10, 10 ), p2( 20, 20 ); p1 = p1 + p2; p1.print(); return ();}执行后的输出结果是( )。
单选题有以下程序: #include <iostream> #include <fstream> using namespace std; int main ( ) ofstream ofile; char ch; ofile.open ("abc.txt"); cin>>ch; while (ch!='#' ) cin>>ch; ofile.put(ch); ofile.close(); return 0; 当从键盘终端连续输入的字符为a、b、c和#时,文件abc.txt中的内容为( )。 A) 程序编译时出错 B) abc# C) abc D) #
单选题下面程序的运行结果是
#include<iostream.h>
Void main( )
{
int num=1;
int
ref=ref+2;
cout < < num;
num=num+3;
cout < < ref < <endl;
}
A) 13 B) 16 C) 36 D) 33
单选题阅读下面的程序: #include <iostream.h> void main() int x; cin>>x; if(x++>5) cout<<x<<endl; else cout<<x--<<endl; 如果两次执行上述程序,且键盘输入分别为4和6,则输出结果分别是( )。 A.4,6 B.3,6 C.4,7 D.5,7
单选题有如下程序
#include
using namespace std;
class A{
public:
virtual Void funcl(){coutfuncl();
p->func2();
retum0;
}
运行程序,屏幕上将显示输出______。
单选题有如下类定义: class AA int a; public : int getRef()const t return //① int getValue()const return a; //② void set(int n)const a=n; //③ friend void show(AA aa)const cout <<a; //④ ; 其中四个函数的定义中正确的是( )。 A) ① B) ② C) ③ D) ④
单选题设有以下定义和程序: #include<iostream.h> class A1 public: void show 1() cout<<" class A 1"<<end1; class A2:public A1 public: void show20 cout<<"class A2"<<end1; ; class A3:protected A2 public: void show3() cout<<"class A 1 "<<end1; ; void main() A1 obj1; A2 obj2; A3 obj3; 则以下不合语法的调用语句是( )。 A) obj1.show1(); B) obj2.show1(); C) obj3.show1(); D) obj2.show2();
单选题有两个关系R,S如下:由关系R通过运算得到关系S,则所使用的运算为()。
单选题已知在一个类体中包含如下函数原型:
VOLUME operator-(VOLbrME)const;
下列关于这个函数的叙述中,错误的是______。
单选题运行以下的程序代码,结果是( )。 #include<iostream> using namespace std; intmain() { int x=5; int *q= int y++; tout<<(*q)++<<end1; return 0; }
单选题在软件生产过程中,给出需求信息的是( )。 A.程序员 B.项目管理者 C.软件分析设计人员 D.软件用户
单选题一个教师可讲授多门课程,一门课程可由多个教师讲授。则实体教师和课程间的联系是( )。
单选题函数swap(a,n)可完成对a数组从第1个元素到第n个元素两两交换。其中b[=1;b[1]=2;swap(b,2)。在运行调用函数中的语句后,b[0]和b[1]的值分别为( )。
单选题有如下程序: #include<iostream> #include<cstring> using namespace std; class MyString { public: char str[80]; MyString(const char*s){strcpy(str,s);} MyString&operator+=(MySring a){ strcat(str,a.str); return*this; } }; ostream&operator<<(ostream&s,const MyString&z){return s<<z.str;} int main(){ MyString x(''abe''),y(''ede''); eout<<(x+=y)<<end1; return 0; } 运行这个程序的输出结果是( )。
单选题在一个C++源程序文件中定义的全局变量的有效范围是( )。 A.该C++程序的所有源程序文件 B.本源程序文件的全部范围 C.从定义变量的位置开始到本源程序文件结束 D.函数内部全部范围
单选题派生类的构造函数的初始化列表中,不能包含______。