单选题有如下程序: #include<iostream> using namespace std; class VAC t public: int f()const{return 3;} int f(){return 5;} }; int main() { VAC v1; const VAC v2; cout<<v1.f()<<v2.f(); return 0; } 执行这个程序的输出结果是( )。
单选题下面程序的输出结果是 #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; A) xyzabcABC B) zabcABC C) xyabcABC D) yzabcABC
单选题下列关于模板的叙述中错误的是______。
单选题下面关于数组的初始化正确的是( )。
单选题有如下程序:
#include<iostream>
using namespace std;
int main(){
int i,s=0;
for(i=1;s<20;i+=2)s+=i*i;
cout<<i<<endl;
return 0;
}
运行这个程序的输出结果是______。
单选题凡是函数中未指定存储类别的局部变量,其隐含的存储类型是
____
。
单选题表达式2! =3的值是 ______。
单选题在32位的计算机中,一个char型数据所占的内存长度的字节是______。
A.4
B.1
C.2
D.8
单选题设a和b均为double型变量,且a=5.5、b=2.5,则表达式(int)a+ b/b的值是
单选题有如下程序:
#include<iostream>
using namespace std;
class Base {
int x;
public:
Base(int n=0): x(n) {cout<<n;}
int getX()const {return x;}
};
class Derived: public Base {
int y;
public:
Derived(int m, int n): y(m), Base(n) {cout<<m;}
Derived(int m): y(m) {cout<<m;}
};
int main()
{
Derived d1(3), d2(5, 7);
return 0;
}
执行这个程序的输出结果是______。
单选题下列程序中,划线处正确的语句是( )。 #include<iostream.h> Class Base Public: Void fun()cout<<"Base::fun"<<endl; ; Class Derived:public Base void fun() ______ //显示调用基类的函数fun() Cout<<"Derived::fun"<<endl; ;A.fun() B.Base.fun() C.Base::fun() D.Base->fun();
单选题有如下程序:
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
cout<<setprecision(3)<<fixed<<
setfill("*")<<setw(8);
cout<<12.345<<______<<34.567;
return 0;
}
若程序的输出是:
**12.345**34.567
则程序中下画线处遗漏的操作符是______。
单选题有以下程序: #include <iostream> using namespace std; class MyClass int m; publ i c: static int n; MyClass ( ) m = 0; void setvalue() m++; n++; void output () cout<<"m="<<m<<'' , n="<<n<<end1; ; int MyClass :: n=0; int main() MyClass obj1, obj2; obj1.setvalue(); objl.output(); obj2.setvalue(); obj2.output(); return 0;
单选题有如下程序: #inc1ude<iostream> #inc1ude<cstring> using namespace std; c1ass MyString{ public: char str[80]; MyString(const char*s){ strcpy(str,s);) MyString } }; ostream} int main(){ MyString x("abc"),y("cde"); cout<<(x+=y)<<end1; return 0; } 运行这个程序的输出结果是( )。
单选题下面程序的功能是将从键盘输入的一对数,由小到大排序输出,当输入一对相等数时结束循环,在划线处应填入的是( )。
#include<iostream.h>
voidmain( )
{ inta,b,t;
cin>>a>>b;
while(______)
{ if(a>b)
{ t=a;a=b;b=t;}
cout<<a<<""<<b<<endl;
cin>>a>>b;
}}
单选题有以下程序: #include<iostream> using namespace std; class A private: int a; public: A(int i) a=i; void disp() cout<<a<<“,”;; class B private: int b; public: B(int j) b=j; void disp() cout<<b<<“,”;; class C:public B,public A private: int C; public: c(int k):A(k-2),B(k+2) c=k; ) void disp() a::disp(); B::disp(); cout<<c<<endl; ; int main() C obj(10); obj.disp(); return 0; 程序执行后的输出结果是( )。
单选题下面哪些函数采用动态联编
____
?
单选题有如下程序: #included<iostream> using namespace std; int main() int f,f1=0,f2=1; for(int i=3;i<=6;i++) f=f1+f2; f1=f2;f2=f; cout<<f<<end1; return 0; 运行时的输出结果是( )。
单选题下列语句段输出字符'*'的个数为( )。 int i=100; while(1) i--; if(i==0) break; cout<<'*';
单选题有如下类定义:
class AA
{
int a;
public:
int getRef()const{return} //①
int getValue()const{return a;} //②
void set(int n)const{a=n;} //③
friend void show(AA aa)const{cout<<a;) //④
};
其中的四个函数定义中正确的是______。
