#include<iostream>
using namespace std;
class t
{
public:
t(int m,int d,int y)
{
if(m>0&&m<13)
month = m;
if(d>1&&d<32)
day = d;
if(y>0&&y<3000)
year = y;
}
~t()
{
cout<<"#########################"<<endl;
}
protected:
int month;
int day;
int year;
};
void fn()
{
t *p;
p=new t(1,5,1998);
cout<<"%%%%%%%%%%%%%%5555"<<endl;
delete p;
}
int main()
{
fn();
return 0;
}
你加一个cin试试
code::block加一个cin可以显示# 我换了一个vc++6.0编译器 不加cin也能显示了!