数据结果上机课设,大二学完之后写的,可运行,没有问题。C语言
资源推荐
资源详情
资源评论
#include <stdlib.h>
#include <stdio.h>
//#include <conio.h>
#define MAX 300 //宏定义
#define TRUE 1
#define FALSE 0
#define R rand()
float wait_length; //等待队列的总长度
int totalnum; //总共顾客数
float totaltime; //顾客理发所需总时间
int curtime; //当前时间
int chairnum; //当前可用的椅子数
int addtime; //扫尾工作时间
typedef struct customer
{
int NO; //编号
int intime; //进入理发店时间
int durtime;
int intertime;
int starttime; //开始理发时间
int leavetime; //离开理发店的时间
int serve_flag; //是否在理发
}customer;
customer cus[MAX];
typedef struct Qnode
{
int num; //理发者的编号
struct Qnode *next;
}Qnode,*QueuePtr;
#include <stdio.h>
//#include <conio.h>
#define MAX 300 //宏定义
#define TRUE 1
#define FALSE 0
#define R rand()
float wait_length; //等待队列的总长度
int totalnum; //总共顾客数
float totaltime; //顾客理发所需总时间
int curtime; //当前时间
int chairnum; //当前可用的椅子数
int addtime; //扫尾工作时间
typedef struct customer
{
int NO; //编号
int intime; //进入理发店时间
int durtime;
int intertime;
int starttime; //开始理发时间
int leavetime; //离开理发店的时间
int serve_flag; //是否在理发
}customer;
customer cus[MAX];
typedef struct Qnode
{
int num; //理发者的编号
struct Qnode *next;
}Qnode,*QueuePtr;
typedef struct
{
QueuePtr front; //队头指针
QueuePtr rear; //队头指针
}LinkQueue;
LinkQueue W; //等待队列
void InitQueue(LinkQueue Q) //队列初始化
{
Q.front=Q.rear=(QueuePtr)malloc(sizeof(Qnode));
Q.front->next=NULL;
}
void outQueue(LinkQueue Q) //输出队列中的元素
{
QueuePtr p;
p=Q.front;
while(p->next)
{
p=p->next;
printf("%d",p->num);
}
printf(" ");
}
int Queue_Length(LinkQueue Q) //求等待队列的当前长度
{
int length=0;
QueuePtr p;
p=Q.front;
{
QueuePtr front; //队头指针
QueuePtr rear; //队头指针
}LinkQueue;
LinkQueue W; //等待队列
void InitQueue(LinkQueue Q) //队列初始化
{
Q.front=Q.rear=(QueuePtr)malloc(sizeof(Qnode));
Q.front->next=NULL;
}
void outQueue(LinkQueue Q) //输出队列中的元素
{
QueuePtr p;
p=Q.front;
while(p->next)
{
p=p->next;
printf("%d",p->num);
}
printf(" ");
}
int Queue_Length(LinkQueue Q) //求等待队列的当前长度
{
int length=0;
QueuePtr p;
p=Q.front;
剩余6页未读,继续阅读







资源评论


上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
已下载
下载帮助

看过该资源的人还看了
没有合适的资源?快使用搜索试试~ 我知道了~
安全验证
文档复制为VIP权益,开通VIP直接复制
