资源简介
bank.cpp
代码片段和文件信息
/*
Name: 银行排队取号系统模拟
Copyright:
Author: ***
Date: 13/04/09 12:45
Description:
*/
#include
#include
//-----------------各个窗口业务队列 ---------------
//typedef int Elem;
typedef struct qNode{
int val;
qNode* next;
}qNode *qPoint;
typedef struct {
int length;
qPoint front;
qPoint rear;
}Bankqueue;
void initQueue(Bankqueue& b){
b.front = b.rear = (qPoint)malloc(sizeof(qNode));
if(!b.front)exit(0);
b.front->next = NULL;
b.length = 0;
}
void destryQueue(Bankqueue& ql){
while (ql.front){
ql.rear = ql.front->next;
free(ql.front);
ql.front = ql.rear;
}
}
void push(Bankqueue& b int e){
qPoint p;
p = (qPoint)malloc(sizeof(qNode));
if(!p)exit(0);
p->val = e;
b.rear->next = p;
b.rear = p;
b.length++;
}
void pop(Bankqueue& b){
// if(b.front->next){
if (b.front != b.rear){
qPoint t;
t = b.front->next;
if (b.rear == t){
b.rear = b.front;
b.front->next =NULL;
}else{
b.front->next = t->next;
}
free(t);
b.length--;
}
// }
}
int front(Bankqueue b){
if (b.front != b.rear){
return b.front->next->val;
}
}
bool empty(Bankqueue b){
return b.length == 0;
}
//-------------------银行卡窗口间队列 --------------------
//typedef struct bNode{
// Bankqueue val;
// bNode* next;
//}bNode *bPoint;
//typedef struct {
// int length;
// bPoint front;
// bPoint rear;
//}Operationqueue;
//void initOpQueue(Operationqueue& b){
// b.front = b.rear = (bPoint)malloc(sizeof(bNode));
// if(!b.front)exit(0);
// b.front->next = NULL;
// b.length = 0;
//}
//void pushb(Operationqueue& b Bankqueue e){
// bPoint p;
// p = (bPoint)malloc(sizeof(bNode));
// if(!p)exit(0);
// p->val = e;
// b.rear->next = p;
// b.rear = p;
// b.length++;
//}
//Bankqueue frontb(Operationqueue b){
// if (b.front != b.rear){
// return b.front->val;
// }
//}
//void popb(Operationqueue& b){
// if(!b.front){
// if (b.front != b.rear){
// bPoint t;
// t = b.front->next;
// if (b.rear == t){
// b.rear = b.front;
// }
// }
// }
//}
//------------------各业务选项方法---------------
//void operationOne(Bankqueue& int); //公积金队列
//void operationTwo(Bankqueue& Bankqueue& int int []); //银行卡队列、银行卡窗口队列、当前客户取号、银行卡窗口数组
//void operationThree(Bankqueue& a Bankqueue& b int i int B[]); //理财卡队列、银行卡队列、当前取得理财卡排除号、银行卡窗口数组
//----
- 上一篇:FIR滤波器的C语言实现
- 下一篇:八数码游戏程序人工智能,c++
相关资源
- 《Linux程序设计》第四版pdf高清电子版
- C++ Primer mobi
- 使用 IBM Rational Systems Developer 和 Rati
- VC编程助手2010破解版(原名VA_X_10.6.
- Linux操作系统下C语言编程从零开始
- 一个C++实现的源代码行数统计工具
- easySize使用方法和代码
- TLV解析算法
- C++ 从入门到精通明日科技光盘 百度云
- C和C++.rar
- consts.cpp
- 银行管理系统.cpp
- VC++外挂框架.rar
- VisualC++网络高级编程.(人民邮电.陈坚
- C++黑客编程揭秘与防范.pdf
- BombGoldFlower.cpp
- c++万能外挂.txt
- ZhajingHua.cpp
- C++AMP.pdf
- c++程序设计语言英文第三版.pdf
- Visual_assist_X_for_VC6.0破解版.rar
- 《C语言程序设计》谭浩强.pdf
- c++辅助源码.rar
- GBT28169-2011嵌入式软件C语言编码规范
- 用MFC实现的图像处理源代码总集
- C语言程序设计(郑莉)源码.rar
- zw_MFC编写一个简单的登录对话框(连
- 鸡啄米:VS2010MFC编程入门教程.pdf
- ATM源代码用c++文件读写.zip
- C语言写的文件传输系统
评论
共有 条评论