以下程序的输出结果是()。 #include
第1题:
下面程序运行后输出的结果是【 】。
include <iostream>
using namespace std;
class example{
const int m;
public:
example(int i):m(i){}
void pr(){cout<<"m="<<m<<endl'}
};
int main(){
example x(100);
x.pr();
return 0;
}
第2题:
以下程序执行后输出的结果是【 】。
include<iostream>
include<fstream>
using namespace std;
int main(){
ofstream ofile("D:\\temp.txt");
if(!ofile){
cout<<"temp.txt cannot open"<<endl;
return 0;
}
ofile<<"This is a book" <<" " <<54321<<endl;
ofile.close();
ifstream ifile("D:\\temp.txt");
if(!ifile){
cout<<"temp.txt cannot open" <<endl;
return 0;
}
charstr[40];
ifile >> str;
ifile.close();
cout<<Str<<endl;
return 1;
}
第3题:
以下程序的输出结果是【 】。
include <iostream>
using namespace std;
int main()
{
char S[ ]="abcdef";
s[3]='\0';
cout<<s<<end1;
return 0;
}
第4题:
下列程序的输出结果是【 】。
inClude<iostream>
rsing namespace std;
template<typename T>
T fun(Ta,Tb){retum(a<=b)?a:b;)
int main()
{
cout<<fun(3,6)<<','<<fun(3.14F,6.28F)<<endl; .
return 0;
}
第5题:
程序的输出结果是【 】。
include <iostream>
using namespace std;
class A{
int x;
public:
A(int x=1):x(x){cout<<x;}
};
void main(){
A a,b(2),c(3);
}
第6题:
以下程序运行后的输出结果是【 】。
include<iostream>
using namespace std;
int main()
{
int i=10,i:0;
do{
j=j+i;
i--;
}while(i>2);
cout<<j<<end1;
return 0;
}
第7题:
若有以下程序段:
include <iostream>
using namespace std;
int main()
{
char*p="abcdefgh",*r;
long*q;
q=(long*)p;q++;
r=(char*)q;
cout<<r<<end1;
return 0;
}
该程序的输出结果是【 】。
第8题:
下列程序的输出结果是______。
include<iostream.h>
include<string.h>
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;
}
第9题:
以下程序的输出结果是 #include<iostream> using nameSpace std; int main() { cout.fill('*'); cout.width(5); cout<<hex<<100<<end1; return 0; }
A.**100
B.***64
C.100**
D.64***
第10题:
以下程序的输出结果是【 】。
include <iostream>
using namespace std;
void fun()
{
static int a=0;
a+=2;
cout<<a;
}
int main()
{
int CC;
for(CC=1;cc<4;CC++)
fun();
cout<<end1;
return 0;
}