📄 handle.h
字号:
#include"customer.H"
struct lids{
double local_money;int local_time;
double ip_money;int ip_time;
double distance_money;int distance_time;
double sum_money;int sum_time;
};
class handle{
struct tempcus{
customer *cus;
tempcus *next;
};
tempcus *firstt,*endd;
lids temp_lids;
public:
handle(){firstt=endd=NULL;}
void commence(){ //将当前时段的有关信息清零,以供下一时段使用
temp_lids.local_money=temp_lids.local_time=temp_lids.ip_time=0;
temp_lids.distance_money=temp_lids.ip_money=temp_lids.distance_time=0;
temp_lids.sum_money=temp_lids.sum_time=0;
}
lids & pass(){return temp_lids; //返回lids 结构体引用供manager类使用
}
void pushin(customer *p){ //向tempcus链表添加成员
tempcus *mm=new tempcus;
mm->cus=p;
if(firstt==NULL){
firstt=mm;
firstt->next=endd;
}
else {
endd=mm;
endd->next=NULL;
endd->next=endd;
}
(*p).out_light()=true;
}
void pushout(tempcus *p){ //从tempcus 链表删除成员
tempcus *m=firstt;
if(p!=firstt){
while(m->next!=NULL){
if(m->next==p) break;
else m=m->next;
}
tempcus *mr;
mr=p->next;
(*(p->cus)).out_light()=false;
delete p;
m->next=mr;
}
else {
firstt=p->next;
(*(p->cus)).out_light()=false;
delete p;
}
}
void reduce(){ //处理所有tempcus链表中用户打电话过程中消费信息
tempcus *mm=firstt;
while(mm!=NULL){system("PAUSE");
if((*(mm->cus)).out_yuhe()<=0||(*(mm->cus)).out_temp_time()<=0||(*(mm->next->cus)).out_yuhe()<=0){
system("PAUSE");
pushout(mm);
system("PAUSE");
cout<<"****"<<endl;
system("PAUSE");
pushout(mm->next);
system("PAUSE");
}
else{system("PAUSE");
if((*(mm->cus)).out_tel_type()=='1'){
(*(mm->cus)).out_yuhe()-=0.001;
(*(mm->cus)).out_sum_consumed()+=0.001;
(*(mm->cus)).out_cur_consumed()+=0.001;
temp_lids.local_money+=0.001;
temp_lids.sum_money+=0.001;
}
else if((*(mm->cus)).out_tel_type()=='2'){
(*(mm->cus)).out_yuhe()-=0.006;
(*(mm->cus)).out_sum_consumed()+=0.006;
(*(mm->cus)).out_cur_consumed()+=0.006;
temp_lids.ip_money+=0.006;
temp_lids.sum_money+=0.006;
}
else if((*(mm->cus)).out_tel_type()=='3'){
(*(mm->cus)).out_yuhe()-=0.018;
(*(mm->cus)).out_sum_consumed()+=0.018;
(*(mm->cus)).out_cur_consumed()+=0.018;
temp_lids.distance_money+=0.018;
temp_lids.sum_money+=0.018;
}
else ;
(*(mm->cus)).out_temp_time()-=1;
(*(mm->cus)).out_cur_time()+=1;
}
mm=mm->next->next;
}
}
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -