更多"下面程序的输出结果是 【15】 。
#include <iostr"的相关试题:
[填空题]下面程序的输出结果是 【13】 。
#include <iostream>
using namespace std;
class A
{
int a, b;
public:
A( )
{
a = b = 0;
}
A(int aa, int bb ) : a(aA) , b(bB)
{
cout <<"a="<<a<<","<<"b="<<b<<",";
}
~A( )
{
cout<<"D";
};
int main ( )
{
A x, y(2, 3);
return 0;
}
[填空题]下面程序运行输出的结果是______。
#include <iostream>
using namespace std;
int main( )
char a[]="Chinese";
a[3]=’/0’;
cout<<a<<endl;
return 0;
[填空题]下列程序的输出结果是【 】
#include<iostream>
using namespace std;
template<typenameT>
Tfun(Ta,TB) {return (a<=B) a:b;}
int main ( )
{
cout<<fun(3,6)<<’’,’’<<fun(3.14F,6.28F)<<end1;
return 0;
}
[单项选择]下列程序的输出结果是【 】
#inClUde<iostream>
using namespace std;
intmain( )
{
Char a[]="HellO,World";
Char*ptr=a;
while(*ptr)
{
if(*ptr>=’’a’’&& *ptr <=’’Z’’)
cout<<char(*ptr+’’A’’ -’’a’’);
else cout<<*ptr;
ptr++;
}
retur0;
}
A. HELLO,WORLD
B. Hello,world
C. hELLO,wORLD
D. hello,world
[填空题]执行下面程序输出的是 【15】 。
#include <iostream>
using namespace std;
template <typename T>
T total(T *data){
Ts=0;
while( *data) s+=*data++;
return s;
}
int main( ){
int s[]={1,3,5,7,0,2,4,6,8};
cout<<total(s);
return 0;
}
[单项选择]下面程序输出的结果是( )。
#include <iostream>
using namespace std;
void swap(int &a,int &b)
int temp;
temp=a;
a=b;
b=temp;
void main( )
int x=2;
int y=3;
swap(x,y);
cout<<x<<y;
A. 23
B. 32
C. ab
D. ba
[单项选择]下面程序输出的结果是( )。 #include<iostream> using namespace std; int test(int n1,int n2) {return n1 +n2;} float test (int f1,float f2){return f1-f2;} float test(float x,float y){return(x+y)/2;} float test(float x,int y){return(x+y)*2;} void main( ){ int a1=10; float a2=2.5f; cout<<test(a1,a2); }
A. 12.5
B. 7.5
C. 6.25
D. 25
[填空题]下面程序输出的结果是
【11】 。
#include <iostream>
using namespacc std;
class A
public:
void show( )tout<<"A!";
;
class B: public A
public:
virtual void show( )cout<<"B!";
;
class C: public B
public:
virtual void show( )cout<<"C!";
;
void show_info(A *i)i->show( );
void main( )
A ia;B ib;C ic;show_info(&i
- a); show_info(&i
- b);show_info(&i
- c);
[填空题]下面程序输出的结果是
【10】 。
#include <iostream>
using namespace std;
class A
public:
virtual void show( ) cout<<"A!";
;
class B: public A
public:
void show( ) cout << "B!";
;
class C: public B
public:
void show( )cout << "C!";
;
void show_info(A &i) i. show( );
void main( )
A ia; B ib; C ic; show_info(i
- a);show_info(i
- b); show_info(i
- c);
[填空题]下列程序的输出结果是 【10】 。
#include <iostream>
using namespace std;
void fun(int &rf)
rf*=2;
int main( )
int num= 500;
fun(num);
cout<<num<<end1;
return 0;
[填空题]以下程序的输出结果是 【9】 。
#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;
}