更多"在下面程序横线处填上适当内容,使程序输出为:55599。 #incl"的相关试题:
[填空题]在下面程序横线处填上适当内容,使得程序的输出为9876。
#include <iostream>
using namespace std;
template<class T>
void f( 【12】 )
T t;
for (int i=0;i<n/2;i++)
t=a Ii];
a [i]=a[n-1-i];
a [n-1-i]=t;
int main ( )
int x[]=6,7,8,9;
f(x,4);
for (int i=0;i<4;i++)
cout<<x[i];
cout<<end1;
return 0;
[填空题]在下面程序横线处填上适当内容,使程序输出为:55599。
#include <iostream>
using namespace std;
template <class TYPE>
class HisClass
{
TYPE data;
public:
HisClass(TYPE a, TYPE b, TYPE C) ;
TYPE getData( ){ return data;)
};
template<class TYPE>
HisClass<TYPE>::HisClass(TYPE a,TYPE b,TYPE C)
{
【12】 ;
else主f(b>C)
data=b;
else
data=c;
}
int main( )
{
HisClass<int> x1(3,4,5),x2(5,3,4),x3(4,5,3),x4(7,8,9),x5(8,7,9);
cout<<x1.getData( )<<x2.getData( )<<x3.getData( )
<<x4.getData( )<<X5.getData( );
return 0;
}
[填空题]在下面程序横线处填上适当内容,以使该程序执行结果为4.4。
#include<iostream>
using namespace std;
template<typename T>
T average(T*datA)
T s=0;
int i:0;
while(data[i])
【12】 ;
return s/(i+1);
int main( )
double x[]=2.5,4.5,6.5,5,0.0,12.5,23.3,18.5;
cout<<average(X);
return 0;
[填空题]在下面程序的横线处填上适当的语句,使该程序执行结果为10。
#include <iostream>
using namespace std;
class MyClass
public:
MyClasS(int A)
X=a;
【13】 //取x的值
private:
int x;
;
int main( )
MyClass my(10);
cout<<my.GetNum( )<<end1;
return 0;
[填空题]在下面程序的横线处填上适当的语句,使该程序的输出为12。
#include <iostream>
using namespace std;
class Base
{
public:
int a;
Base(int i){ a=i; }
class Derived : public Base
{
int a;
public:
Derived(int x) : Base(x),b(x+1){}
void show( )
{
______; //输出基类数据成员a的值
cout<<b<<endl;
}
};
int main ( )
{
Derived d(1);
d.show( );
return 0;
}
[填空题]在下面的程序的横线处填上适当的语句,使该程序的输出为12。
#include 〈iostream〉
using namespace std;
class Base
public:
int a;
Base(int i) a=i;
;
class Derived : public Base
int a;
public:
Derived(int x) : Base(x),b(x+1)
void show( )
〈u〉 【14】 〈/u〉; //输出基类数据成员a的值
cout〈〈b〈〈end1;
;
int main( )
Derived d(1);
d.show( );
return 0;
[填空题]在下面的程序的横线处填上适当的语句,是该程序的输出为12。
#include<iostream>
using namespace std;
class Base
public:
int a;
Base(int i)a=i;
;
class Derived:public Base
int a;
public:
Derived(int x):Base(x),b(x+1)
void show( )
【11】 ; //输出基类数据成员a的值。
cout<<b<<endl;
;
int main( )
Derived d(1);
d.show( );
return 0;