C语言数据结构实现银行模拟
实现代码:
#include
#include
#include
#define MAX_WIN 20
#define MAX_STAY 100
typedef struct customer *link;
struct customer
{
int stay;
link next;
};
link GUY(int stay, link next)
{
link c = malloc(sizeof *c);
c->stay = stay;
c->next = next;
return c;
}
link win[MAX_WIN];
void morning()
{
int i;
for(i = 0; i < MAX_WIN; i++)
{
win[i] = NULL;
}
}
void come(int w, int stay)
{
if(win[w] == NULL)
{
win[w] = GUY(stay, NULL);
win[w]->next = win[w];
}
else
win[w] = win[w]->next = GUY(stay, win[w]->