?? flist.cpp
字號:
#include "Flist.h"
#include "Date.h"
#include "JiHua.h"
#include "iostream.h"
#include "string.h"
Flist * Flist::select1(Date *riqis,Date *riqie)
{
Flist * list=new Flist();
POSITION pos=GetHeadPosition();
while(pos)
{
JiHua * jihua=(JiHua*)GetNext(pos);
if(jihua->getstart()->bijiao(riqis)==0&&jihua->getend()->bijiao(riqie)==0)
list->AddTail(jihua);
}
return list;
}
void Flist::shuchuplan()
{
int month,day,date,hour,min;
int hour1,min1,renshu;
POSITION pos=GetHeadPosition();
while(pos)
{
JiHua * jihua=(JiHua*)GetNext(pos);
Date * e=jihua->getend();
Date * s=jihua->getstart();
month=e->getmonth();
day=e->getday();
date=e->getdate();
hour=s->gethour();
min=s->getmin();
hour1=e->gethour();
min1=e->getmin();
renshu=jihua->getrenshu();
char name[20];
strcpy(name,jihua->getlinkman());
cout<<"開始使用會議室的時間是:"<<month<<"月"<<date<<"日,星期"<<day<<"開始使用時間"<<hour<<"時"<<min<<"分,結束時間"<<hour1<<"時"<<min1<<"分";
cout<<"參加會議的人數是:"<<renshu<<"人,聯系人:"<<name<<endl;
}
}
int Flist::select2(Date *riqis,Date *riqie)
{
Flist * list=new Flist();
POSITION pos=GetHeadPosition();
while(pos)
{
JiHua * jihua=(JiHua*)GetNext(pos);
if(!panduan1(riqis,riqie))
{
return 0;
break;
}
}
return 1;
}
int Flist::panduan1(Date *riqis,Date *riqie)
{
int j=0;
POSITION pos=GetHeadPosition();
if(!pos)
return 1;
while(pos)
{
JiHua * jihua=(JiHua *)GetNext(pos);
if(jihua->getstart()->gethour()<riqis->gethour()&&jihua->getend()->gethour()>riqis->gethour()||jihua->getstart()->gethour()<riqie->gethour()&&jihua->getend()->gethour()>riqie->gethour())
{j=1;
break;}
if(jihua->getstart()->gethour()==jihua->getend()->gethour())
{
if(jihua->getstart()->getmin()<riqis->getmin()&&jihua->getend()->getmin()>jihua->getstart()->getmin()||jihua->getstart()->getmin()<riqie->getmin()&&jihua->getend()->getmin()>jihua->getend()->getmin())
{j=1;
break;}
}
else
{
if(riqis->gethour()==jihua->getstart()->gethour()&&jihua->getstart()->getmin()<riqis->getmin())
{j=1;
break;}
else {
if(riqis->gethour()==jihua->getstart()->gethour()&&jihua->getstart()->getmin()>riqis->getmin())
if(riqie->gethour()==jihua->getstart()->gethour()&&jihua->getstart()->getmin()<riqie->getmin())
{
j=1;
break;
}
else if(riqie->gethour()==jihua->getend()->gethour())
{
j=1;
break;
}
}
if(riqis->gethour()==jihua->getend()->gethour()&&jihua->getstart()->getmin()>riqis->getmin())
{
j=1;
break;
}
}
}
if(j==1)
{
return 0;
}
return 1;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -