请把下列序号下划线补充完整#include <stdio.h> #include "util.h" #include "linklist.h" typedef enum { wsNormal = 0, //窗口正常 wsPause = 1 } EWinStatus; #define WIN_TYPE_SIZE 32 typedef char WinType[WIN_TYPE_SIZE]; static char gszWinTypeTip[256]; static WinType gWinType[10] = {0}; //窗口业务类型,最多10个类型 static LinkListMan gLinkMan = {0}; LNode *GetWinNode(int nWinId); void OnWinShow(void *para); void OnWinNew(void *para); void OnWinDel(void *para); void OnWinPause(void *para); void OnWinResume(void *para); void OnCustomerArrive(void *para); void OnCustomerLeave(void *para); Status LoadData(); void OnWinManage(void *para) { SCmd acmd[] = {{"WinShow", "窗口状态", OnWinShow}, {"WinNew", "窗口新增", OnWinNew}, {"WinDel", "窗口删除", OnWinDel}, {"WinPause", "窗口业务暂停", OnWinPause}, {"WinResume", "窗口业务恢复", OnWinResume}, {"", "", NULL}, {"CustomerArrive", "取号排队", OnCustomerArrive}, {"CustomerLeave", "办结离队", OnCustomerLeave} }; if (LoadData() != OK) { PRINTF("配置数据加载失败!\n"); return; } CmdLoop(acmd, numof(acmd), NULL); } void OnWinShow(void *para) { LNode *p = GetFirstElemNodePtr(gLinkMan); char szStatus[2][16] = {"正常", "暂停"}; PRINTF("窗口号\t状态\t排队人数\t平均得分\n"); while (p != NULL) { const SWin *pWin = &(p->win); char szScore[32]; if (pWin->RemarkNum > 0) { float fAvg = (float)pWin->ScoreSum / (float)pWin->RemarkNum; sprintf(szScore, "%f", fAvg); } else { strcpy(szScore, "-"); } PRINTF("%d\t%s\t%d\t\t%s\n", pWin->id, szStatus[pWin->status], QueueLength(pWin->Q), szScore); p = GetNextElemNodePtr(p); } } void OnWinNew(void *para) { int nWinId, nType; LNode *pWinNode; SWin win = {0}; if (!InputInteger(nWinId, "请输入整数型窗口编号:")) return; pWinNode = GetWinNode(nWinId); if (pWinNode != NULL) { PRINTF("%d 窗口已经存在!\n", nWinId); return; } if (!InputInteger(nType, gszWinTypeTip)) return; win.id = nWinId; win.type = nType; QueueInit(win.Q); if (LL_Append(gLinkMan, win) == OK) { PRINTF("新增窗口成功!\n"); } else { PRINTF("新增窗口失败!\n"); } } void OnWinDel(void *para) { 1.__ ; } //窗口业务暂停 void OnWinPause(void *para) { 2.; } //窗口业务恢复 void OnWinResume(void *para) { 3.; } void OnCustomerArrive(vo
时间: 2024-03-29 20:42:04 浏览: 121
C标准库函数集
5星 · 资源好评率100%
id *para) { int nWinId; LNode *pWinNode; if (!InputInteger(nWinId, "请输入整数型窗口编号:")) return; pWinNode = GetWinNode(nWinId); if (pWinNode == NULL) { PRINTF("%d 窗口不存在!\n", nWinId); return; } SCustomer ctm = {0}; ctm.nId = ++gLinkMan.nCustIdSeed; ctm.nWinId = nWinId; ctm.nArriveTime = time(NULL); PRINTF("请 %d 号客户到 %d 号窗口办理业务!\n", ctm.nId, nWinId); QueueEn(pWinNode->win.Q, ctm); } void OnCustomerLeave(void *para) { 4.; } //加载数据的函数,具体实现不在此处展示,略去
阅读全文