?? homeworklist.cpp
字號:
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include "homeworklist.h"
using namespace std;
homeworklist::homeworklist()
{
current_size = 0;
}
bool homeworklist:: add (homework h)
{
if(current_size < LIST_MAX)
{
list[current_size] = h;
current_size++;
return 1;
}
else
{
return false;
}
}
homeworklist homeworklist:: dueafter (date d)
{
homeworklist hl = homeworklist();
int dateBool;
date d1 = date();
homework cmpDate = homework("",d1,d);
for(int i=0;i<current_size;i++)
{
dateBool = list[i].compareTo(cmpDate);
if(dateBool == 1)
{
hl.add(list[i]);
}
}
return hl;
}
homeworklist homeworklist:: duebefore (date d)
{
homeworklist hl = homeworklist();
int dateBool;
date d1 = date();
homework cmpDate = homework("",d1,d);
for(int i=0;i<current_size;i++)
{
dateBool = list[i].compareTo(cmpDate);
if(dateBool == -1)
{
hl.add(list[i]);
}
}
return hl;
}
homeworklist homeworklist:: dueon (date d)
{
homeworklist hl = homeworklist();
int dateBool;
date d1 = date();
homework cmpDate = homework("",d1,d);
for(int i=0;i<current_size;i++)
{
dateBool = list[i].compareTo(cmpDate);
if(dateBool == 0)
{
hl.add(list[i]);
}
}
return hl;
}
ostream &operator<< (ostream &stream, homeworklist hl)
{
for(int i = 0 ; i <hl.current_size ; i++)
{
stream << hl.list[i] << endl;
}
return stream;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -