Example Analysis of C language Source Code in Restaurant ordering system
This article is to share with you the content of the sample analysis of the C language source code in the restaurant ordering system. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Restaurant ordering system c language source code, some encapsulated functions, the operation of the linked list, as well as file access, for your reference, the details are as follows
# include "public.h" struct NODE * myhead;struct NODE * orderhead;struct NODE * ashead;char waiter_ ID [4 + 1] / * * set input box color * name: set input box color parameter: iNum: edit the length function of the box: * * / void SetColorEdit (int iNum) {SetColor (4. 14) While (iNum--) {putchar ('');}} void SetColor (unsigned short ForeColor,unsigned short BackGroundColor) {HANDLE hCon=GetStdHandle (STD_OUTPUT_HANDLE); SetConsoleTextAttribute (hCon, (ForeColor) | (BackGroundColor*16)) } / * * edit box aUI function * * name: edit box aUI function parameter: iLong: edit box length iWide: edit box width x table Show: edit box start position y means: edit box start column position acBuffer: edit box display function: in x row y column to make an edit box with iLong length and width iWide The text in the box displays the contents of the acBuffer string * / void UI_EditBox (int iLong,int iWide,int x int iLong,int iWide,int int yjinchar acBuffer [30]) {int I / * width * / int j; / * length * / Gotoxy (xPowery); for (I = 0; I ='0' & & Tmp ='A' & & Tmp ='a' & & Tmp ='A' & & Tmp ='a' & & Tmp ='0' & & Tmp data = data; head- > NEXT = NULL; return head) } / * * add linked list node function * * name: add linked list node function parameters: phead: chain header node data: data len: size function of the linked list node data structure to be operated Add linked list node * * / void LinkAddNode (struct NODE * phead) Void * data, int len) {struct NODE * pNew Struct NODE * pTemp; pTemp = phead; while (pTemp- > NEXT! = NULL) {pTemp = pTemp- > NEXT;} pNew = (struct NODE *) malloc (sizeof (struct NODE)); if (pNew = = NULL) {perror ("LindAddNode error"); return;} else {pNew- > data = malloc (len); if (pNew- > data = NULL) {perror ("LindAddNode error"); return;} memcpy (pNew- > data, data, data); len > len = len > pNew- = pNew- } / * int DataInit () {int i; struct MAN m [] = {{"1001", "admin", "123456", 0,1}, {"1002", "manager", "123456", 1,1}, {"1003", "waiter", "123456", 2,1}}; I = 0; myhead = (struct NODE*) LinkInit (NULL); for (I = 0; I
< 3; i++) { LinkAddNode(myhead, &m[i], sizeof(m[i])); } return 0;}*//*******************************释放链表函数******************************** 名称:释放链表函数 参数: phead:链表头节点 功能: 释放链表 **************************************************************************/void LinkFreeNode(struct NODE *phead){ struct NODE *pTemp = phead; //static int aaa = 0; while(pTemp != NULL) { phead = phead->