使用标准命名空间的语句是()
第1题:
以下程序的执行结果为______。
include<iostream>
using namespace std;
class base
{
public:
virtual void who()
{
cout<<"base class"<<endl;
}
};
class derivel:public base
{
public:
void who()
{
cout<<"d
第2题:
下列程序的输出结果是______。
include<iostream>
using namespace std;
void fun(int &rf)
{
rf*=2;
}
int main()
{
int num=500;
fun(num);
cout<<num<<endl;
return 0;
}
第3题:
下列程序的输出结果是______。
include<iostream>
using namespace std;
int main()
{
int data=l;
int &r = data;
data+=5;
r+=5;
cout<<data<<endl;
return 0;
}
第4题:
关于语句 #include<iostream> using namespace std; void main( ) { cout < < 100.8989663 < < '; cout < < fixed < < 100.8989663 < <'; cout < < scientific < < 100.8989663 < <';} 的输出结果为
A.100.899 100.898966 1.008990e+002
B.100.8989663 100.898966 1.008990e+002
C.100.899 100.898966 1.008989e+002
D.100.899 100.8989663 1.008989e+002
第5题:
下列程序的输出结果是【 】。
include<iostream>
include<cstring>
using namespace std;
void fun(const char *s,char &c){c=s[strlen(s)/2];}
int main()
{
char str[]="ABCDE";
char ch=str[1];
fun(str,ch);
cout<<ch;
return 0;
}
第6题:
有如下程序: #include <iostream> using namespace std; class AA { public: virtual void f() { cout<< "AA"; } }; class BB : public AA { public: BB() { cout << "BB"; } }; cla
A.AA
B.AABBCC
C.BBAABBCC
D.BBBBAACC
第7题:
有以下程序: #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);
A.程序编译时出错
B.abc#
C.abc
D.#
第8题:
以下程序的运行结果是【 】。
include<iostream>
include<string>
using namespace std;
void main(){
chara[10]="China",b[]="Chin",c[]="ese";
cout<<strlen(strcat(strcpy(a,b),c))<<endl;
}
第9题:
有如下程序: #include <iostream> #include <iomanip> using namespace std; int main() { cout.fill('*'); cout.width(6); cout.fill('#'); cout<<123<<end1; return 0; } 执行生的输出结果是( )。
A. ###123
B.123###
C. ***123
D.123***
第10题:
下列程序的运行结果为( )。 #include <iostream> using namespace std; namespace m { int flag = 10; } namespace n { flag = 100; } void mian( ) { int flag = 0; using namespace n; cout<<flag<<","<<m:: flag; }
A.100,10
B.100,0
C.0,100
D.0,10
第11题:
请在下列程序的横线处填写正确的语句。
include<iostream>
using namespace std;
class Base{
public:
void fun(){cout<<"Base fun"<<endl;}
};
class Derivde:public Base{
public:
void fun(){
______∥ 调用基类的函数
第12题:
using namespace std;
using namespace iostream;
include std;
include iostream;
第13题:
下列程序的执行结果是______。
include<iostream.h>
include<iomanip.h>
using namespace std;
voidmain()
{
cout<<setfill('x')<<setw(10);
cout<<"Hello"<<end1;
}
第14题:
下面程序运行输出的结果是【 】。
include <iostream>
using namespace std;
int main(){
char a[]="Chinese";
a[3]='\0';
cout<<a<<endl;
return 0;
}
第15题:
下面程序的执行结果是【 】。
include<iostream>
include<iomanip>
using namespace std;
void main()
{
cout<<setfill('x')<<setw(10);
cout<<"Hello"<<endl;
}
第16题:
下面程序的运行结果为( )。 #include <iostream> using namespace std; void main( ) { for(int a =0,x =0; !x&&a < =10; a ++ ); cout << a << endl;
A.0
B.1
C.10
D.11
第17题:
有如下的程序:
include<iostream>
using namespace std;
class AT{
friend ostream & operator<<(ostream&,AT);
}at;
ostream& operator<<(ostream& os,AT){return os<<'@';}
int main(){
cout<<"MyHome"<<at<<"isHere.com";
}
执行上面的程序将输出
第18题:
有以下程序: #include <iostream> #include <string> using namespace std; class base { private: char baseName[10]; public: base ( ) { strcpy (baseName, "Base"); } virtual char *myName() {
A.DerivedBase
B.BaseBase
C.DerivedDerived
D.BaseDerived
第19题:
下面程序的运行结果为( )。 #include <iostream> using namespace std; class A{ public: A(){cout<<" ";} ~A(){cout<<" ";} } class B:public A{ public: B(){cout<<" ";} ~B(){cout<<" ";} } void main(){ B b; }
A.1234
B.1324
C.1342
D.3142
第20题:
有如下程序: #include <iostream> #include <iomanip> using namespace std; int main() { cout.fill('*'); cout << left << setw(4) << 123 << "OK" << endl; return 0; }
A.123*OK
B.123*OK**
C.*123OK
D.*123**OK
第21题:
下面的程序输出的结果是( )。 #include <iostream> using namespace std; void main(){ int a=2; int &c=a; a++; cout<<c; }
A.2
B.3
C.4
D.*a
第22题:
请在如下程序中的空格处填写正确的语句:
include <iostream>
using namespace std;
class Base {
public:
void fun() {cout<<"Base fun"<<endl; }
};
class Derived: public Base {
public:
void fun() {
【 】; //调用基类的函数fun()
cout<<"Derived fun "<<endl;
}
};
第23题:
在下面横线上填上适当的语句,完成程序。
include<iostream>
using namespace std;
class Base
{
int x;
public:
Base(int i){x=i;}
~Base(){}
);
class Derived:public Base
{
public:
______//完成类Derive构造函数的定义
};
iht main()
{
Derived obj