![]() |
#2
cnfarer2010-03-31 16:53
|
#include <iostream.h>
class Date
{
int mo, da, yr;
public:
Date( int m, int d, int y )
{
mo = m; da = d; yr = y;
}
friend ostream& operator<< (ostream& os, Date& dt );
};
ostream& operator<< ( ostream& os, Date& dt )
{
os << dt.mo << '/' << dt.da << '/' << dt.yr;
return os;
}
int main()
{
Date d(1965,12,25);
cout<<d<<endl;
return 0;
}
*****************************************************************************************
#include <iostream>
using namespace std;
class Date
{
int mo, da, yr;
public:
Date( int m, int d, int y )
{
mo = m; da = d; yr = y;
}
friend ostream& operator<< (ostream& os, Date& dt );
};
ostream& operator<< ( ostream& os, Date& dt )
{
os << dt.mo << '/' << dt.da << '/' << dt.yr;
return os;
}
int main()
{
Date d(1965,12,25);
cout<<d<<endl;
return 0;
}
*******************************
新手囊中羞涩。。。。请大侠不要见怪啊*^_^*