更多"下面程序的运行结果是 【8】 #include <iostream"的相关试题:
[单项选择]下面程序的运行结果是( )。 #include <iostream> using namespace std; template <class T> class A{ T x,y; public: A(T a,T b){x=a;y=b;} int add( ){return x+y;} }; void main( ){ A<double>a(7.8,3.4); A<char>b(7.8,3.4); cout<<a.add( )<<","<<b.add( ); }
A. 10,10
B. 11,11
C. 11,10
D. 以上答案都不对
[填空题]下面程序的运行结果是 【8】
#include <iostream>
using namespace std;
int fun(int n)
static int m = 2;
m=m+n;
return m;
int main ( )
int a = 3, b = 4;
int x;
x = fun( a );
x = fun( b );
cout<<x<<end1;
return O;
[填空题]下面程序执行的结果是 【14】
#include<iostream>
using namespace std;
class A
public:
static int x;
A(inty)cout<<x+y;
;
int A::x=2;
void main( )
A a(5);
[单项选择]下面程序输出的结果是( )。
#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 main( )
int x[6]=1,3,5,7,9,11,*k,**s;
k=x;
s=&k;
cout<<*(k++)<< “,”<<**s<<end1;
return 0;
A. 3,3
B. 1,1
C. 3,5
D. 3,1
[单项选择]下面函数的运行结果是( )。 #include <iostream> using namespace std; class A{ public: A( ){} int Min(int a,int b){return a<b a:b;} int Min(int a,int b,int c){ if(a<b)return a<c a:c; else return b<c b:c; } ~A( ){} }; void main( ){ A a; cout<<a.Min(1,2,3)<<a.Min(2,0); }
A. 10
B. 12
C. 30
D. 32