c语言程序逻辑错误,c语言程序,现在出现逻辑错误,哪位高手指点下啊。。。...

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

#include"c1.h"

#include

#include

typedef struct LNode{事件练表的元素类型

int OccurTime;

int NType;

LNode *next;

}Event,ElemType,*xx;

typedef struct Head /此时要是这个head名字和LinkList一样,则出错

{

ElemType *head;

ElemType *tail;

int len;

}LinkList;

typedef struct QNode{/队列的元素类型

int Arrivetime;

int Duration;

QNode *next;

}QElemType;

struct LinkQueue///

{

QElemType *front;

QElemType *rear;

};

/

typedef LinkList EvenList;

EvenList ev;//

Event en;

LinkQueue q[5];

QElemType Customer;

int TotalTime,CustomerNum,CloseTime;

///

Status InitList(LinkList &L) 构造一个空的线性链表

{

ElemType *p;

p=(ElemType*)malloc(sizeof(LNode)); // 生成头结点

if(p)

{

p->next=NULL;

L.head=L.tail=p;

L.len=0;

return OK;

}

else

return ERROR;

}

//初始化一个队列

Status InitQueue(LinkQueue &Q)

{

Q.front=Q.rear=(QElemType*)malloc(sizeof(QNode));

if(!(Q.front))

exit(OVERFLOW);

Q.front->next=NULL;

return OK;

}

///

int cmp(Event a,Event b)

{

if(a.OccurTime==b.OccurTime)

return 0;

else

return (a.OccurTime-b.OccurTime)/abs(a.OccurTime-b.OccurTime);

}

此处是声明一个函数的入后点

void OrderInsert(LinkList &L,ElemType en,int (*cmp)(ElemType ,ElemType ))// 已知L为有序线性链表,将元素e按非降序插入在L中///调试次函数形式的作用

{

ElemType *o,*p,*q;

q=L.head;

p=q->next;/p指向第一个元素节点

while(p!=NULL&& cmp(*p,en)<0) // p不是表尾且元素值小于e、、、、、p前面加一个*是指针的形式转化成结构

{

q=p;

p=p->next;

}

o=(ElemType*)malloc(sizeof(LNode)); // 生成结点

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值