当前位置:首页 » 编程语言 » 叫号取号系统c语言
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

叫号取号系统c语言

发布时间: 2023-01-24 07:05:21

c语言用编程做一个餐厅叫号系统。包括用户登录,叫号,选桌(大小桌),统计(大小桌使用量,翻台率)

#include <stdio.h>

#include <stdlib.h>

char g_uniqueKey[24] = {0};

void ShowMainDlg()

{

system("cls");

printf("========XX餐厅======== ");

printf("1-取号 2-叫号 3-退号 4-退出系统 ");

printf("====================== ");

printf("请选择对应菜单(1~4):");

}

void ShowAddDlg()

{

system("cls");

printf("========取号======== ");

printf("请输入姓名 电话 用餐人数,按空格分隔 ");

printf("====================== ");

}

void ShowQueryDlg(char cName[], char cTel[], int iPeople)

(1)叫号取号系统c语言扩展阅读:

餐厅桌号预订系统基本功能:

1、餐厅提供小,中,大三种餐位,分别对应0~4人,5~8人,9人以上;

2、每种餐位若干,每个餐位都有相应的编号;

3、每种餐位使用收取的费用不同;

4、每位客人根据就餐人数选择不同类型的餐位,系统则根据等待人数给用户生成一个等待号码,显示客人当前排号以及在他之前有多少位客人在等待。

5、不同类型餐位都有自己的一个等待列,为客人生成的号码互不影响;

6、支持查询指定号码所在的餐位。




Ⅱ C语言考试中 求求各位帮帮忙 谢谢

#include <stdio.h>
#include <stdlib.h>
#define ASK_OP(response) puts("INPUT O = IN Ordinary V = IN VIP Q = QUIT");response = getch();
typedef struct _cus{
int no;
char type;
int type_num;
struct _cus *next;
}customer;

int main(int argc, char *argv[])
{
customer * phead = NULL, *pcur = NULL, *ptail = NULL;
int i,j;
char ch;
ASK_OP(ch);
while(('Q' != ch) && ('q' != ch))
{
if('o' == ch || 'O' == ch)
{
if(NULL == phead)
{
if(NULL == (phead = (customer *)malloc(sizeof(customer))))return ;
phead->no = 1;
phead->type = 'o';
phead->type_num = 0;
phead->next = NULL;
pcur = phead;
}
else
{
i=0; //记录类型为 Ordingary 的个数
ptail = phead;
while(!(NULL == ptail->next))
{
if(ptail->type == 'o') i = ptail->type_num;
ptail = ptail->next;

}
if(ptail->type == 'o') i = ptail->type_num;
if(NULL == (pcur = (customer *)malloc(sizeof(customer)))) return ;
ptail->next = pcur;
pcur->no = ptail->no+1;
pcur->type = 'o';
pcur->type_num = i+1;
pcur->next = NULL;
}
printf("\n%d Ordinary %d 前面有%d人等待\n",pcur->no,pcur->type_num,pcur->no-phead->no);
}
if('v' == ch || 'V' == ch)
{
if(NULL == phead)
{
if(NULL == (phead = (customer *)malloc(sizeof(customer)))) return ;
phead->no = 1;
phead->type = 'v';
phead->type_num = 0;
phead->next = NULL;
pcur = phead;
}
else
{
i=0; //记录类型为 Vip 的个数
ptail = phead;
while(!(NULL == ptail->next))
{
if(ptail->type == 'v') i = ptail->type_num;
ptail = ptail->next;

}
if(ptail->type == 'v') i = ptail->type_num;
if(NULL == (pcur = (customer *)malloc(sizeof(customer)))) return ;
ptail->next = pcur;
pcur->no = ptail->no+1;
pcur->type = 'v';
pcur->type_num = i+1;
pcur->next = NULL;
}
printf("\n%d VIP %d 前面有%d人等待\n",pcur->no,pcur->type_num,pcur->no-phead->no);
}
ASK_OP(ch);
}
printf("\n GOOD bye");

system("PAUSE");
return 0;
}

Ⅲ 如何用简单的c语言编写银行的排队取号系统

可以用栈队列来实现呀

Ⅳ C语言银行排队系统

你所指的队列是线程吗?
线程操作,大概思路如下:
1. 创建4个线程,表示四个窗口,用semaphore来等待客户进入(WaitForSingleObject).
2. 创建n个线程表示客户,每创建一个客户增加一个ReleaseSemaphore,以让窗口处理(记录相关信息,随机时间可以用srand获取),窗口要设定为while循环,可以多次处理,条件可以设置为处理多少个客户就可以退出.
3. 共用资源记得设置临界区CriticalSection.

Ⅳ C#银行排队叫号系统

// 写了一个比较简陋的排队系统,可以参考下:

classProgram{
staticvoidMain(string[]args){
ServiceWindow[]serviceWindows=newServiceWindow[Bank.MAX];
for(inti=0;i<Bank.MAX;i++)
serviceWindows[i]=newServiceWindow(){No=(i+1).ToString()};

Bankbank=newBank(serviceWindows);
Randomrand=newRandom();

//多线程模拟顾客取号
newThread(()=>{
intk=0;
while(true){
Bank.Enqueue();

if(++k>=100)break;

Thread.Sleep(1000);
}
}).Start();

//多线程模拟服务窗口叫号
newThread(()=>{
while(true){
bank.ServiceWindows[rand.Next(0,Bank.MAX)].Call();
Thread.Sleep(3000);
}
}).Start();

Console.ReadKey(true);
}
}

internalclassBank{
publicconstintMAX=3;
publicstaticConcurrentQueue<uint>queue{get;set;}
publicstaticvolatileuintcurNo=0;
publicBank(){
Init();
}
publicvoidInit()
{
queue=newConcurrentQueue<uint>();
}
publicBank(ServiceWindow[]serviceWindows)
{
Init();
ServiceWindows=serviceWindows;
}
publicServiceWindow[]ServiceWindows{get;set;}

publicstaticvoidEnqueue()
{
intk=0;
k=queue.Count();
curNo++;
queue.Enqueue(curNo);

Console.WriteLine("您的号码是:"+(curNo)+",前面还有"+k+"人在等待!");
}
}
internalclassServiceWindow{
publicStringNo{get;set;}
publicboolCall()
{
uintresult=0;
boolsuccess=false;
success=Bank.queue.TryDequeue(outresult);
if(success)Console.WriteLine(result+"号,请到"+No+"号窗口办理业务!");
returnsuccess;
}
}

Ⅵ 银行排队系统叫号,怎么样使各个窗口同时工作,c语言

设置一个标志,工作时置为1 然后while循环检测时间, 到时间了就置为0,然后跳出while循环

调用窗口的时候先检测该窗口的这个状态,如果为1就接着检测下个窗口,直到该窗口状态为0,就为其服务

Ⅶ C语言问题 急

没考虑输入是否合法(例如客户类型只能为Ordinary和VIP,退出用Quit),
时间关系凑合着用,按正确输入的话能实现
#include "stdio.h"
#include "malloc.h"
#include "string.h"
#define null 0
struct List
{
char guesttype[10];
struct List *next;
}List;

struct List * InitList()
{
struct List *head,*p,*q;
head=(struct List *)malloc(sizeof(struct List));
head->next=null;
q=head;
int i;
bool star=true;
char c,InQuit[10],guest[10];
for (i=0;i<10&&(c=getchar())!='\n';i++)
{
if (c==' ')
{
star=false;
i=-1;
continue;
}
if (star)InQuit[i]=c;
else guest[i]=c;
}
guest[i]='\0';
while(InQuit[0]=='I'&&InQuit[1]=='N')
{
p=(struct List *)malloc(sizeof(struct List));
p->next=null;
strcpy(p->guesttype,guest);
q->next=p;
q=p;
star=true;
for (i=0;i<10&&(c=getchar())!='\n';i++)
{
if (c==' ')
{
star=false;
i=-1;
continue;
}
if (star)InQuit[i]=c;
else guest[i]=c;
}

}
return head;
}

void print(struct List *head)
{
struct List *p;
int num=0;
if(head)
{
p=head->next;
while(p)
{
printf("IN:\n");
printf("%d %s %d\n",num+1,p->guesttype,num);
p=p->next;
num++;
}
printf("GOOD BYE!\n");
}
}

void main()
{
struct List *head;
head=InitList();
print(head);
}

Ⅷ 简单的银行叫号系统 C++编程

编程是好比是两个城市之间的旅程,开发语言(C++)就好比是交通工具,其实乘坐什么工具并不重要,最重要的是你要知道怎么走,也就是整个程序的设计你要明了。废话少说,下面简单介绍一下这个系统的开发流程:
第一步,先把数据库设计好,如果是单个银行网点,可以用ACCESS或者sqllite数据库,如果是某个银行集团的多个网点,那就需考虑用大型数据库了,比如Microsoft SQL Server;
数据库中最起码要包含以下几个表:
1,业务类型表:
2,取号类型表(普通号、优先号)
3,挂号表等
第二步,搭系统框架,这个是整个程序的基石,如果如果要自己设计的话,首先你要有两三年的编程经验,急不得。你可以去网上或者是学长那找一些好的模板,这样会快一点。
4,画界面
整个程序的界面包含主界面和一些基本数据的维护界面以及统计报表等,这个需要你一步一步去画。
5,基本的增删改查数据库操作
界面画好之后,就要对基本数据进行处理了,程序的许多BUG也会在这个时候产生,这个也是基本功,祝你好运。
6,数据的增删改查做完之后整个程序的开发也就完成的差不多了,剩下的就是一下细节性的东西,不过此时你的旅途只完成了一半。
7,还有一半的工作就是测试测试再测试
若还有疑问,咨询HESIN排队。网络HESIN排队就可以。

Ⅸ 用C语言编银行叫号系统

#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <conio.h>

#define MAX_SIZE 500
struct tagCustom
{
int m_nID; // 客户的编号
int m_nProcessTime; // 需要处理业务的时间
int m_nArrivalTime; // 到达时间
int m_nDepartTime; // 离开时间
};

struct tagTeller
{
int m_nCustomNum; // 处理的客户数
int m_nAllServiceTime; // 所有服务时间
int m_nFinishServiceTime; // 柜台针对一个客户服务的结束时间
bool m_bBusy; // 柜台是否忙
int m_nCustomID; // 正在服务的客户的ID号
};

tagTeller g_aryTellers[MAX_SIZE];
int g_nTellerNum; // 柜台数量

// 用户到达数组(随机的,无序的)
tagCustom g_aryAllCustoms[MAX_SIZE];
int g_nCustomsNum;

int g_nWorkTime; // 经营时间
int g_nArrivalRange,g_nServiceRange;

// 用户队列
tagCustom g_CustomQueue[MAX_SIZE];
int g_nHeader,g_nTail;

// 队列的操作
void InitQueue()
{
g_nHeader = g_nTail = -1;
}

void AddToTail(tagCustom aCustom)
{
g_nTail++;
g_CustomQueue[g_nTail] = aCustom;
}

bool RemoveFromHeader(tagCustom* pCustom)
{
if(g_nHeader < g_nTail)
{
g_nHeader++;
(*pCustom) = g_CustomQueue[g_nHeader];
return true;
}
return false;
}

// 功能:模拟用户的随机到来
void GenerateCustom()
{
tagCustom aCustom;
for(int nCounter = 0; nCounter < g_nCustomsNum; nCounter++)
{
aCustom.m_nID = nCounter;
aCustom.m_nArrivalTime = rand() % g_nWorkTime ;
aCustom.m_nProcessTime = (rand() % g_nServiceRange + 1) * 6;
aCustom.m_nDepartTime = -1;
g_aryAllCustoms[nCounter] = aCustom;
}
}

void Init()
{
g_nTellerNum = 3;
g_nWorkTime = 200;
g_nCustomsNum = 30;
g_nArrivalRange = 18 ;
g_nServiceRange = 5 ;

srand((unsigned)time(NULL));
InitQueue();
GenerateCustom();

for(int nC = 0; nC < g_nTellerNum; nC++)
{
g_aryTellers[nC].m_nAllServiceTime = 0;
g_aryTellers[nC].m_nCustomID = -1;
g_aryTellers[nC].m_bBusy = false;
g_aryTellers[nC].m_nFinishServiceTime = -1;
}
}