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)); // 生成結點
總結
以上是生活随笔為你收集整理的c语言逻辑错误调试,c语言程序,现在出现逻辑错误,哪位高手指点下啊。。。...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: c语言期末作业自己设计个小程序,帮看一个
- 下一篇: 九九乘法表c语言编程伪代码,py_11分