更多"根据下列程序的执行结果,可以断定划线部分的修饰符应为______。执行"的相关试题:
[填空题]根据下列程序的执行结果,可以断定划线部分的修饰符应为 【14】 。
执行结果:
i9a football is created.
a football is created.
i=10
a football is destroyed.
a football is created.
i=20
a football is destroyed.
a football is destroyed.
源程序:
# inelude<iostream. h>
class Footballpublic:
Football( ) cout<<"a football is created. "<<end1;
~Football( ) cout<<"a football is destroyed. "<<end1;
;
void func(int i) ______ Football f1;
Football f2;
cout<<"i= "<<i<<end1;void main( ) func(10);
func(20);
[填空题]根据下列程序的执行结果,可以断定划线部分的修饰符应为______。执行结果:
i9a football is created.
a football is created.
i=10
a football is destroyed.
a football is created.
i=20
a football is destroyed.
a football is destroyed.
源程序:
#include<iostream.h>
class Football
public:
Football( )cout<<"a football is created."<<endl;
~Football( )tout<<"a football is destroyed."<<endl;
;
void func(int i)
______Football f1;
Football f2;
cout<<"i="<<i<<endl;
void main( )
func(10);
func(20);
[简答题]在下面程序横线处填上适当内容,使程序执行结果为:40:15程序如下:
#include<iostream.h>
template<class T>
T func(T x,T y)
if(sizeof(T)= =8)
return______;
else
return______;
void main( )
cout<<func(8,5)<<":"<<func(5.0,10.0)<<endl;
int d;cin>>d;
[简答题]在下面程序横线处填上适当内容,使程序执行结果为:
n=9
程序如下:
#include<iostream.h>
template<class T>
class Test
T n;
public:
Test( )
Test(T i)n=i;
Test<T>______(const Test <T> &s)
static Test<T>temp:
______;
return temp;
void disp( )cout<<"n="<<n<<endl;
;
void main( )
Test<int>t1(4),t2(5),t3;
t3=t1+t2:
t3.disp( );
[单项选择]下列程序执行结果是
#include <iostream.h>
class A
public:
int a;
A( ):a(10)cout<<a<<endl;
;
void main( )
A obj1;
A obj2(obj1);
cout<<" "<<obj2.a<<endl;
A. 10 10
B. 编译错误缺少拷贝构造函数
C. 10随机数
D. 随机数随机数
[填空题]在下面程序的横线处填上适当的语句,使该程序执行结果为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;
}
[简答题]在下面程序横线处填上适当内容,使程序执行结果为:200_ _100。
#include<iostream.h>
template<class T>
T f(______)
if(______)
return x+y;
else
return x*y;
void main( )
cout<<f(10,20)<<"_ _"<<f(45.5,54.5)<<endl;
[简答题]在下面程序的横线处填上适当内容,使程序执行结果为:"hello,andylin"。
#include<iostream>
#include<string.h>
using namespace std;
class mystring
public:
char*pdata;
mystring(int len)
pdata=new char[len+1];
~mystring( )
delete pdata;
void show( )cout<<pdata<<endl;
;
void fun(mystring**array,int len)
mystring*old=*array;
______
memcpy(*array,old,len);
void main( )
mystring str(20);
mystring*pstr=&str;
mystring**ppstr=&pstr;
strcpy(str.pdata,"hello,andylin");
fun(ppstr,20);
______
[单项选择]若一程序运行时独占系统全部资源,资源的状态只受该程序而改变,程序执行结果不受外界因素的影响,这是指( )。
A. 程序顺序执行的顺序性
B. 程序顺序执行的封闭性
C. 程序顺序执行的可再现性
D. 并发程序失去封闭性
[单项选择]以下程序执行结果是 ( )。
#include <iostream.h>
class Base
public
virtual void fun( ) cout<<"B";
;
class Derived
public:
Derived( ) cout<<"D";
virtual void fun( ) Base::fun( ); cout<<"C";
int main ( )
Base *ptr;
Derived obj;
ptr=&obj;
p->fun ( );
return 0;
A. DBC
B. DCB
C. BDC
D. CBD
[填空题]在下面程序横线处填上适当内容,以使该程序执行结果为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;
[填空题]程序执行结果s的值是 【14】 .
Private Sub Command l-Click ( )
I =0
Do
S= I +S
I = I + l
Loop Until I >=4
End Sub
[填空题]程序执行结果s的值是 。
Private Sub sub1(Byval p As Integer)
p=p*2
End Sub
Private Sub Command1_ Click( )
Dim i As Integer
i=3
Call sub 1 (i)
if i>4 then i=i mod 2
Print cstr(i)
End Sub