更多"下列程序的输出结果是( )。 #include<iostream"的相关试题:
[填空题]下列程序的输出结果是 【14】
#include<iOStream>
using namespace std;
template <typename T>
T total (T*datA)
T s=0;
while(*datA)
s+=*data++;
return s;
int main( )
int x[]=2,4,6,8,0,12,14,16,18;
cout<<total(x)<<end1;
return 0;
[填空题]下列程序的输出结果是 【8】
#include<iostream>
using namespace std;
int main( )
{
int Bum=500;
int& ref=num;
ref+=100;
cout<<num<<end1;
return 0;
}
[填空题]下面程序的输出结果是 【15】 。
#include<iostream>
using namespace std;
class base
protected:
int a;
public:
base( )cout<<"0":
;
class base1:virtual public base
public:
base1( )cout<<"1";
;
class base2:virtual public base
public
base2( )cout<<"2";
;
class derived:public base1,public base2
public:
derived( )cout<<"3";
int main( )
derived obj;
cout<<end1;
return 0;
[填空题]下列程序的输出结果是 【10】 。
#include<iostream>
using nameSpace std;
int main( )
int data=1;
int &r=data;
data+=5;
r+=5;
cout<<data<<end1;
return 0;
[填空题]以下程序的输出结果是 【6】 。
#include <iostream>
using namespace std;
int main( )
int s,i;
for(s=0,i=1;i<3;i++)
s+=i;
cout<<s<<end1;
return 0;
[填空题]下面程序的输出结果是 【8】 。
#include <iostream>
using namespace std;
int d=1;
fun(int p)
static int d = 5;
d+ =p;
cout<<d;
return (d) ;
void main ( )
int a =3;
cout<<fun ( a + fun (d) )<<endl;
[填空题]下列程序的输出结果是 【10】 。
#include<iostream>
using namespace std;
void fun (int &rf)
rf*=2;
int main( )
int num:500;
fun(num);
cout<<num<<endl;
return 0;
[填空题]下列程序的输出结果是 【11】 。
#include<iostream>
using namespace std;
class Test{
public:
Test( ){cnt++;)
~Test( ){cnt--;)
static int Count( ){retum cnt;}
private:
static int cnt;
};
int Test::cnt=0;
int main( )
{
cout<<Test::Count( )<<’’;
Test t1,t2;
Test*pT3=new Test;
Test*p T4=new Test;
cout<<Test::Count( )<<’’;
delete pT4;
delete pT3;
cout<<Test::Count( )<<endl;
return0;
}
[填空题]执行这个程序的输出结果是( );
#include<iostream>
using namespace std;
class TestClass1
public:
void fun1( )cout<<"TestClass1/n";
virtual void fun2( )cout<<"TestClass1/n";
;
class TestClass2:public TestClass1
public:
void fun1( )cout<<"TestClass2/n";
void fun2( )cout<<"TestClass2/n";
;
void f(TestClass1&b)b.fun1( );b.fun2( );
int main( )
TestClass2 obj;
f(obj);
return 0;
[填空题]下列程序的输出结果是______。
#include<iostream)
using namespace Std;
Class Test
public:
Test( )cnt++;
~Test( )cnt--;
staticint 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( )<<endl;
return 0;