更多"下列程序的输出结果是 【13】
#include<iostrea"的相关试题:
[填空题]下面程序输出的结果是
【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);
[填空题]以下程序的输出结果是 【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;
[填空题]下列程序的输出结果是 【15】 。
#include <iostream>
using namespace std;
class base
public:
int n;
base(iht x) n=x;
virtual void set(int m) n=m;cout<<n<<’’;
;
class deriveA: public base
public:
deriveA(int x):base(x)
void set(int m)n+=m;cout<<n<<’’;
:
class deriveB:public base
public:
deriveB(int x):base(x)
void set(int m) n+=m;cout<<n<<’’;
;
int main( )
deriveA d1(1);
deriveB d2(3);
base *pbase;
pbase=&d 1;
pbase->set(1);
pbase=&d2;
pbase->set(2);
return 0;
[填空题]下列程序的输出结果是 【11】 。
#include <iostream>
using namespace std;
class Test
public:
Test( ) cnt++;
~Test( ) cnt--;
static int Count( ) (return cnt;
private:
static int cnt;
;
int Test::cnt=0;
int main( )
cout<<Test::Count( )<<’’;
Test t1, t2;
Test *pT3=new Test;
Test *pT4=new Test;
cout<<Test::Count( )<<’’;
delete pT4;
delete pT3;
cout<<Test::Count( )<<end 1;
return 0;
[填空题]下列程序的输出结果是 【10】 。
#include <iostream>
using namespace std;
int main( )
int i=5;
iht & r=i;r=7;
cout<<i<<end 1;
return 0;
[填空题]以下程序的输出结果是 【10】 。
#include <iostream>
using namespace std;
int main( )
char S[ ]="abcdef";
s[3]=’\0’;
cout<<s<<end1;
return 0;
[填空题]下面程序的输出结果是 【8】 。
#include<iostream>
using namespace std;
int x;
void funA(int&,int);
void funB(int,int&);
int main( )
{
int first;
int second=5;
x=6;
funA(first,seconD) ;
fimB(first,seconD) ;
cout<<first<<" "<<second<<" "<<x<<end1;
return 0;
}
void funA(int &a,int B)
{
int first;
first=a+b;
a=2*b;
b=first+4;
}
void funB(int u,int &v)
{
int second;
second=x;
v=second+4;
x=u+v;
}
[填空题]以下程序的输出结果是 【8】 。
#include<iostream>
using namespace std;
int main( ){
int sum,i;
for(sum=0,i=1;i<5;i++)sum+=i;
cout<<sum<<endl;
return 0;
}
[单项选择]有以下程序,其输出结果是( )。
#include <iostream>
using namespace std;
int main( )
char a[10]='1','2','3','4','5','6','7','8','9',0,*p;
int i=8;
p=a+i;
cout<<p-3<<endl;
return 0;
[单项选择]以下程序执行后的输出结果是( )。
#include<iostream>
using namespace std;
void try(int,int,int,int);
int main( )
int x,y,z,r;
x=1;
y=2;
try(x,y,z,r);
cout<<r<<endl;
return 0;
void try(int x,int y, int z,int r)
z = x+y;
X = x*x;
y = y*y;
r = z+x+y;
A. 18
B. 9
C. 10
D. 不确定
[填空题]下列程序的输出结果是______。
#include <iostream>
using namespace std;
template <typename T>
T fun(Ta,Tb) return(a<=b)a:b;
int main( )
cout<<fun(3,6)<<’,’<<fun(3.14F,6.28F)<<endl;
return 0;