homework.cpp
来自「SSD5 中EX1的参考答案 下载后请参照注释认真分析」· C++ 代码 · 共 33 行
CPP
33 行
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include "homework.h"
using namespace std;
homework::homework ()
{
name = "";
assigned_date = date();
due_date = date();
}
homework::homework (string name, date assigned_date, date due_date)
{
this->name = name;
this->assigned_date = assigned_date;
this->due_date = due_date;
}
int homework::compareTo (homework another_homework)
{
int dateBool = this->due_date.compareTo(another_homework.due_date);
return dateBool;
}
ostream &operator<< (ostream &stream, homework h)
{
return stream<<h.name<<" : "<<h.assigned_date<<"-"<<h.due_date;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?