下面程序的输出结果为【 】。
inclUde<iostream.h>
void main()
{
int a;
int &b=a;//变量引用
b=10;
cout<<"a="<<a<<endl;
}
第1题:
下面程序运行时输出结果为______。
include<iostream.h>
include
class Rect
{
public:
Rect(int l, int w){length=l; width=w;)
void Print(){cout<<"Area:"<<length*width<<end1;}
void operator delete(void*p){free(p);}
private:
int length, width;
};
void main()
{
Rect *p;
p=new Rect(5, 4);
p->Print();
delete p;
}
第2题:
以下程序的输出结果是【 】。
include<iostream. h>
void main() {
int *p;
p=new int;
*p=200;
cout<<*p;
delete p;
}
第3题:
以下程序的输出结果是( )。 include<stdio.h> void swap(int*a,int*B){int*t; t=a;a=b;b=c;} main() {int i=3,j=5,*p=&i,*q=&j; swap(p,q);printf("%d %d\n",*p,*q); }
第4题:
下面程序运行时输出结果为【 】。
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;
}
第5题:
下面程序的结果为______。
include<iostream.h>
void main()
{
int 3=1,b=2;
bool c=1;
if(a>b)||c)cout<<“true”<<endl;
else
cout<<“false”<<endl;
}