Qt银行管理系统原理介绍

Qt是跨平台C++图形用户界面应用程序开发框架,基本上Qt 同 X Window 上的 Motif,Openwin,GTK 等图形界 面库和 Windows 平台上的 MFC,OWL,VCL,ATL 是同类型的东西。但是,我一直对MFC望而生畏,Qt界面还是比较美观的。
我的实现过程还是比较简单的,就是把一个普通的银行管理系统,以一个头文件,源文件的形式引入到Qt中(可能表述的不是很正确,但就是那个意思)然后Qt以槽函数的形式调用银行的各种函数,与银行相关的主要变量设计成全局变量,鼠标点击,调用槽函数便实现了银行签到等一系列操作
以下是两个银行类的头文件

class Bank
{
   
protected:
	int data[20];                        //  排队队列
	int count, ct, counta;                 //  计数器
	int front, rear;                      //  排队指针
	int ave;
	int client[4];                       //  每个窗口的客户数
	int business[4][4];                  //  每个窗口的业务数
	
public:
	Bank();
	~Bank();
	void Enqueue(int x);                 //  入队函数
	int Dequeue();                       //  出队函数
	int Empty();                         //  判断排队人数
	int Emptya();
	void Count(int x);
	double Average();
	void Client(int a[4]);
	void Business(int a[4][4]);
	int num = 0;
	                  //  每个窗口的客户数
	friend DWORD WINAPI fun(LPVOID Bks);              //  线程函数
	friend void Windows(Bank& Bk);
};
//                         随机类       *************************************** 
class Bank_stochastic
{
   
public:
	Bank_stochastic();
	~Bank_stochastic();
	void Stochastic(Bank_stochastic& Bks);            //  随机客户函数
	void Stochastica(Bank_stochastic& Bks);           //  随机时间函数
	void Enqueue(int x);                              //  入队函数
	void Enqueuea(int x);                             //  入队时间函数
	int Dequeue();                                    //  出队函数 
	int Dequeuea();                                   //  出队时间函数
	void Windows(Bank_stochastic& Bks);               //  窗口函数
	int set_time();                           //  时间修改函数
	double Stay();                                    //  客户逗留时间
	int Count();                                      //  总人数函数
	void Client();                                    //  窗口客户数
	void Business(int a[4][4]);                                  //  窗口业务数
protected:
	int data[100];
	int work[100];
	int f, r;                            //   随机时间工作指针
	int front, rear;
	int count;                          //  总客户数
	int ct[4];                          //  判断是否为8小时
	int timeadd;                         //  时间加法器
	int business[4][4];                 //  每个窗口的业务数
	int client[4];
};

源文件

#include"work.h"
#include<stdio.h>
#include<string>
#include<ctime>
#include<stdlib.h>
#include<iostream>
#include <time.h> 
#include<string>
using namespace std;
int a[4] = {
    0 };
int b[4][4] = {
    0 };
Bank::Bank()
{
   
	rear = front = 19;
	count = -4;
	ct = 0;
	ave = 0;
	counta = 0;
	int i, j;
	for (i = 0; i < 4; i++)
	{
   
		client[i] = 0;                   //每个窗口的客户数 
		for (j = 0; j < 4; j++)
		{
   
			business[i][j] = 0;         //每个窗口的业务数
		}
	}

}
Bank::~Bank()
{
   
}
void Bank::Enqueue(int x)
{
   
	if ((rear + 1) % 20 == front)
		throw "error";
	rear = (rear + 1) % 20;
	data[rear] = x;
	count++;
	ct++;
}
int Bank::Dequeue()
{
   
	if (rear == front)
		throw "error";
	front = (front + 1) % 20;
	count--;        //判断队列中有没有人 
	return data[front];
}
int Bank::Empty()
{
   
	return count;
}
int Bank::Emptya()
{
   
	return ct
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值