?? date.cpp
字號:
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include "date.h"
using namespace std;
date::date ()
{
day = 0;
month = 0;
year = 0;
}
date::date (int day, int month, int year)
{
this->day = day;
this->month = month;
this->year = year;
}
int date::compareTo (date another_date)
{
if(this->year == another_date.year)
{
if(this->month == another_date.month)
{
if(this->day == another_date.day)
{
return 0;
}
else if(this->day < another_date.day)
{
return -1;
}
else
{
return 1;
}
}
else if(this->month < another_date.month)
{
return -1;
}
else
{
return 1;
}
}
else if(this->year < another_date.year)
{
return -1;
}
else
{
return 1;
}
}
ostream &operator<< (ostream &stream, date d)
{
return stream << d.month<<"/"<<d.day<<"/"<<d.year;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -