pex6_4.cpp

来自「数据结构C++代码,经典代码,受益多多,希望大家多多支持」· C++ 代码 · 共 46 行

CPP
46
字号
#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 + =
减小字号Ctrl + -
显示快捷键?