单选题程序中有如下语句for(int i=0;i<5;i++)cout<<*(p+i)<<",";能够依次输出int型一维数组a的前5个元素。由此可知,变量P的定义及初始化语句是
____
。
单选题存在定义int a[10] ,x, * pa;,若pa=&a[0] ,下列的哪个选项和其他3个选项不是等价的?
单选题有如下程序: #include <iostream> using namespace std; class Stack { public: Stack(unsigned n= 10):size(n) {rep_=ew int[size]; top=0;} Stack(Stack for(int i=0;i<size;i++) rep_[i]=s.rep_[i]; top=s.top; } ~Stack() {delete []rep_;} void push(int a) {rep_[top]=a; top++;} int pop() {--top;return rep_[top];} bool isEmpty() const {return top==0;} private: int *rep_; unsigned size,top; }; int main() { Stack s1; for(int i= 1;i<5 ;i++) s1. push(i); Stack s2(s1); for(i= 1 ;i<3;i++) cout<<s2.pop()<<','; s2.push(6); si.push(7); while(!s2.isEmpty()) cout<<s2.pop()<<','; return 0; }执行上面程序的输出是______ 。
单选题有以下程序: #include<iostream.h> void main() int x=10,y=10; for(int i=0;x>8;y=++i) cout<<x--<<","<<y<<","; 该程序运行后的输出结果是( )。
单选题下列关于运算符重载的描述中,正确的是
A. 运算符重载可以改变操作数的个数
B. 运算符重载可以改变运算符的优先级
C. 运算符重载可以改变运算符的结合性
D. 运算符重载可以使运算符实现特殊功能
单选题下面程序的运行结果是 #include"iostream.h" #define sum(a,b) a*b void main( ) int x; x=sum(1+2,3); cout<<x;
单选题打开文件时可单独或组合使用下列文件打开模式:
①ios_base::app ②ios_base::binary
③ios_base::in ④los_base::out
若要以二进制读方式打开一个文件,需使用的文件打开模式为______。
单选题有如下类定义: class MyBase int k; public: MyBase(int n=0):k(n) int value( )constreturn k; ; class MyDerived:MyBase int j; public: MyDerived(int i):j(i) int getK( )eonstreturn k; int getJ( )constreturn j; ; 编译时发现有一处语法错误,对这个错误最准确的描述是
单选题有如下程序段: int i=0,j=1; nt&r=i;//① r-j;//② int*p=&i;//③ *p=&r;//④ 其中会产生编译错误的语句是( )。
单选题C ++中的模板包括( )。
单选题C++中运算符优先级由高到低排列正确的是 A) ::++ + || B) < *|| , C) sizeof %+:: D) ,&& new sizeof
单选题在类中重载赋值运算符时,应将其声明为类的( )。
单选题下面关于虚函数的描述中,正确的是( )。
单选题有以下程序
#include <iostream>
using namespace std;
static int days[]= { 31,28,31,30,31,30,31,31,30,31,30,31 };
class date
{
private:
int month, day, year;
public:
date( int m, int d, int y )
{
month = m;
day = d;
year = y;
}
date()
{}
void disp()
{
cout<<year<<"-"<<month<<"-"<<day<<end1;
}
date operator+( int day )
{
date dt = *this;
day+= dt.day;
while ( day > days[dt.month - 1 ] )
{
day -= days[ dt.month - 1 ];
if ( ++dt.month == 13 )
{
dt.month = 1;
dt.year++;
}
}
dt.day = day;
return dt;
};
int main()
{
date d1( 6, 20, 2004 ), d2;
d2: d1 + 20;
d2.disp();
return 0;
}
执行后的输出结果是
单选题下列语句段将输出字符"*"的个数为______。
int i=100;
while(1){
i--;
if(i==0) break;
cout<<"*";
}
单选题下面程序的输出结果是______。
#include<iostream.h>
#include<string.h>
void main()
{
char p1[10],p2[10];
strcpy(p1,"abc");
strcpy(p2,"ABC");
char str[50]="xyz";
strcpy(str+2,strcat(p1,p2));
cout<<str;
}
单选题下列关于函数模板的描述中,正确的是______。
单选题类型修饰符unsigned修饰( )是错误的。
单选题若要对Date类中重载的加法运算符成员函数进行声明,下列选项中正确的是{{U}} {{/U}}
A.Data+( Data);
B.Data operator+(Data);
C.Data+operator(Data);
D.operator+(Data.Data);
单选题下面描述中,不属于软件危机表现的是( )。