下面程序的结果为_____。
include<iostream.h>
void main( )
{
int a=1,b=2;
bool c=1;
if((a>b) | | c) cout < < "tree" < < endl;
else
cout < < "false" < < endl;
}
第1题:
下列程序的运行结果为【 】。
include<iostream.h>
void main(void)
{int a=2,b=-1,c=2;
if(a<b)
if(b<0)c=0;
else c=c+1;
cout<<c<<endl;
}
第2题:
下面程序运行时输出结果为【 】。
include<iostream.h>
include<malloc.h>
class Rect
{
public:
Rect(int1,int w)(length=1;width=w;)
void Print(){cout<<"Area:"<<length *width<<endl;)
void *operator new(size-t size){return malloc(size);}
void operator delete(void *p){free(p)
private:
int length,width;
};
void main()
{
Rect*p;
p=new Rect(5,4);
p->Print();
delete p;
}
第3题:
下面程序的结果为______。
include<iostream.h>
void main()
{
int 3=1,b=2;
bool c=1;
if(a>b)||c)cout<<“true”<<endl;
else
cout<<“false”<<endl;
}
第4题:
下面程序的输出结果是______。 #include<stdio.h> main() { char *p[]="BOOL","OPK","H","SP"}; int i; for(i=3;i>=0;i-,i-) printf("%c",*p[i]); printf("\n"); }
A.SO
B.SP
C.SPOPK
D.SHOB
第5题:
下面程序的输出结果是______。 #inc1ude<stdio.h> main() { char*p[]={"BOOL","OPK","H","SP"}; int i; for(i=3;i>=0;i-,i-) prinf("%c",*p[i]); print("\n") }
A.SO
B.SP
C.SPOPK
D.SHOB