📄 pex6_4.cpp
字号:
#include <iostream.h>
#pragma hdrstop
#include "wex6_8.h"
// for convenience, define a stream output operator
ostream& operator<< (ostream& ostr, Date& d)
{
// just use the method PrintDate
d.PrintDate();
return ostr;
}
// return the minimum of the dates x and y
Date Min(const Date& x, const Date& y)
{
if (x < y)
return x;
else
return y;
}
void main(void)
{
// declare some dates for testing Min
Date d1(6,6,44), d2("1/1/99"),
d3("12/25/76"), d4(7,4,76), d;
d = Min(d1,d2);
cout << "The minimum of " << d1 << " and "
<< d2 << " is " << d << endl << endl;
d = Min(d3,d4);
cout << "The minimum of " << d3 << " and "
<< d4 << " is " << d << endl;
}
/*
<Run>
The minimum of June 6, 1944 and January 1, 1999 is June 6, 1944
The minimum of December 25, 1976 and July 4, 1976 is July 4, 1976
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -