更多"若有如下程序: #include<iostream> us"的相关试题:
[单项选择]若有如下程序: #include<iostream> using namespaee std; int fun( ) { static int i=0; int s=1; s+=i; i++; return s; } int main( ) { int i,a=0; for(i=0;i<5;i++) a+=fun( ); cout<<a<<end1; return 0; } 程序运行后,输出的结果是( )。
A. 20
B. 24
C. 25
D. 15
[单项选择]有如下程序:
#include <iostream>
using namespaee std;
class Point
public:
static int number;
Point( )number++;
~Point( )number--;
;
int Point::number=0;
void main( )
Point*ptr;
Point A,B;
Point*ptr_point=new Point[3];
ptr=ptr_point;
Point C;
cout<<Point::number<<endl;
delete[ ]ptr;
程序的输出结果是
A. 3
B. 4
C. 6
D. 7
[填空题]有如下程序:
#include <iostream>
using namespaee std;
class ONE{
public:
virtual void f( ){cout<<"1";}
};
class TWO:public ONE{
public:
TWO( )1 cout<<"2";}
{;
class THREE://public TWO{
public:
virtual void f( )}TWO::f( );cout<<"3";}
};
int main( ){
ONE aa,*P;
TWO bb;
THREE cc;
P=&cc;
p->f( );
return 0;
}
程序的输出结果是______。
[填空题]有如下程序:
#include<iostream>
using namespaee std;
class A{
public:
A( ){cout<<"A";}
~A( ){cout<<"A";}
};
class B{
A a;
public:
B( ){cout<<"B";}
~B( )t cout<<"B";}
};
int main( ){
B b;
return 0;
}
程序的输出结果是______。