/*
* Copyright (c)2015,烟台大学计算机与控制工程学院
* All rights reserved.
* 文件名称:实训-银行业务的模拟系统.cbp
* 作 者:孙浩瀚
* 完成日期:2015年12月23日
* 版 本 号:v1.0
* 问题描述:设计一个银行业务的模拟系统,模拟银行的业务运行并计算一天中客户在银行逗留的平均时间。
* 输入描述:测试数据
* 程序输出:测试数据
*/
#include<iostream>
#include<string>
#include<time.h>
#include <stdio.h>
#include <malloc.h>
using namespace std;
int total; //初始资金
int closeTime; //营业结束时间
int arriveTime; //两个到达事件之间的间隔上限
int dealTime; //客户之间交易的事件上限
int dealMoney=5000; //交易额上限
int currentTime=0; //当前时间
int totalTime=0; //客户逗留总时间
int counter=0; //客户总数
int number=1; //初始客户序列号
struct service{
int num; //客户号
string type; //到达或离开
int beginTime;
int endTime;
int money; //正数为存款,负数为取款
service *next;
};
//队列
struct queue
{
service *head;
service *rear;
};
void push(queue &q,int d) //插入元素d为Q的新的队尾元素
{
service *temp=new service;
temp->money=d;
temp->next=NULL;
if(NULL==q.head) //队列为空,初始化
{
q.head=temp;
q.rear=temp;
}
else //队列不为空,插入元素d
{
q.rear->next=temp;
q.rear=q.rear->next;
}
}
void pop(queue &q) //若队列不空,出队列函数
{
service *temp;
temp=q.head;
if(NULL==q.head->next)
q.head=q.rear=NULL;
else
q.head=q.head->next;
delete temp;
}
se
12-16
01-03
12-03
1239
