逻辑错误有哪些c语言,c语言程序,现在出现逻辑错误,哪位高手指点下啊。。。...
該樓層疑似違規(guī)已被系統(tǒng)折疊?隱藏此樓查看此樓
#include"c1.h"
#include
#include
typedef struct LNode{事件練表的元素類型
int OccurTime;
int NType;
LNode *next;
}Event,ElemType,*xx;
typedef struct Head /此時(shí)要是這個(gè)head名字和LinkList一樣,則出錯(cuò)
{
ElemType *head;
ElemType *tail;
int len;
}LinkList;
typedef struct QNode{/隊(duì)列的元素類型
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) 構(gòu)造一個(gè)空的線性鏈表
{
ElemType *p;
p=(ElemType*)malloc(sizeof(LNode)); // 生成頭結(jié)點(diǎn)
if(p)
{
p->next=NULL;
L.head=L.tail=p;
L.len=0;
return OK;
}
else
return ERROR;
}
//初始化一個(gè)隊(duì)列
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);
}
此處是聲明一個(gè)函數(shù)的入后點(diǎn)
void OrderInsert(LinkList &L,ElemType en,int (*cmp)(ElemType ,ElemType ))// 已知L為有序線性鏈表,將元素e按非降序插入在L中///調(diào)試次函數(shù)形式的作用
{
ElemType *o,*p,*q;
q=L.head;
p=q->next;/p指向第一個(gè)元素節(jié)點(diǎn)
while(p!=NULL&& cmp(*p,en)<0) // p不是表尾且元素值小于e、、、、、p前面加一個(gè)*是指針的形式轉(zhuǎn)化成結(jié)構(gòu)
{
q=p;
p=p->next;
}
o=(ElemType*)malloc(sizeof(LNode)); // 生成結(jié)點(diǎn)
總結(jié)
以上是生活随笔為你收集整理的逻辑错误有哪些c语言,c语言程序,现在出现逻辑错误,哪位高手指点下啊。。。...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 基金买入时间选择技巧 可以选择股市低迷
- 下一篇: c语言的多线程,如何用C语言实现多线程