?? 01.cpp
字號:
#include<iostream.h>
#include<malloc.h>
class Rect
{
int length,width;
public:
Rect (int l,int w)
{
length=l,width=w;
}
void disp()
{
cout <<"面積"<<length*width <<endl;
}
void *operator new (size_t size)
{
return malloc(size);
}
void operator delete (void *p)
{
free (p);
}
};
void main()
{
Rect *p;
int l,w;
cout<<"Enter the length:";
cin>>l;
cout<<"enter the width:";
cin>>w;
p=new Rect (l,w);
p->disp();
delete p;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -