我是靠谱客的博主 聪慧毛衣,最近开发中收集的这篇文章主要介绍餐饮管理系统(C语言实现),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

该项目由C语言实现,主要分为两个子系统:1.用户子系统;2.商家子系统。
其中用结构体存储顾客信息,位置距离信息,订单信息,商家信息。用hash函数映射值存储顾客名和商家名,通过深拷贝对信息存储,并将信息从文件读取,存储文件,完成对顾客,商家的管理(用户名,密码)
可实现用户注册,登录,订餐,生成订餐订单,同时生成位置订单,商家注册,登录,同时展现菜单。

main.c文件(主程序)

#include "config.h"
#include <ctype.h>
#include <windows.h> 

ConsumerInfoList consumers;
IndentInfoList indents;
DistanceList distances;
MerchantInfoTable merchants;

char consumer_file[100] = "user.txt";
char indent_file[100] = "order.txt";
char distance_file[100] = "distance.txt";
char merchant_file[100] = "shop.txt";

int compare(const char* str1, const char* str2){
    return !strcmp(str1, str2);
}

void initDataInfo();

void printShopInfo(MerchantInfo* merchant);

void trim(char *str);

/**
 * 散列表
**/
// 初始化哈希表
void HashInit();

int hashKey(char name[]);

void HashInsert(MerchantInfo* merchant);

void HashRemove(char* name);

void showHashTable();

// 拷贝节点
MerchantInfo* HashCopy(MerchantInfo* node);

void HashFree(MerchantInfo* node);

void HashDestroy();

MerchantInfo* findHashTable(char* name);

/**
 * 信息处理模块
**/
// 读取文件
void readConsumers();

void readIndents();
void readMerchants();

void readDistances();

// 写入文件
void writeConsumers();
void writeIndents();

void writeMerchants();


/**
 * 用户子系统
**/

// 用户登陆
ConsumerInfo* consumerLogin();

// 用户注册
void registerConsumer();
/* 个人信息管理 */
void showConsumerInfo(ConsumerInfo* info);

void updateConsumerInfo(ConsumerInfo* info);

void removeConsumerInfo(ConsumerInfo* info);




/* 餐馆查询 */
void merchantSearch();

/* 餐馆预定 */
void showConsumerBooking(ConsumerInfo* info);

void showConsumerBookingInMerchant(ConsumerInfo* info);

void merchantBooking(ConsumerInfo* info);

void consumerManage();



/**
 * 商家子系统
**/

// 商家登陆
char* merchantLogin();

/* 餐馆信息管理 */
// 查询餐馆信息
void merchantInfoSearch(char* name);

// 修改餐馆信息
char* merchantInfoUpdate(char* name);
// 注销餐馆信息
void merchantInfoRemove(char* name);

/* 餐馆预定信息管理 */
// 查询所有预定
void showRestaurantReserve(char* name);
// 查询某用户预定
void showConsumerReserve(char* name);

// 处理预定
void dealingReserve(char* name);

void merchantManage();











int main(int argc,char *argv[ ]) {
    int select;
    initDataInfo();

    while(1){
        printf("*        1、用户子系统              *n");
        printf("*        2、商家子系统              *n");
        printf("*        3、用户注册                *n");
        printf("*        0、退出系统                *n");
        printf("请输入选择【0-3】:");
        system("color 1A");
        scanf("%d",&select);
        switch(select){
            case 0:
                writeIndents();
                writeMerchants();
                writeConsumers();
                HashDestroy();
                system("color 1A"); 
                return 0;
            case 1:
                consumerManage();
                system("color 1A");
                break;
            case 2:
                merchantManage();
                system("color 1A");
                break;
            case 3:
                registerConsumer();
                system("color 1A");
                break;
            default:
                printf("输入错误n");
        }
    }
}

void initDataInfo() {
    readConsumers();
    readIndents();
    readDistances();
    HashInit();
    readMerchants();
}

void printShopInfo(MerchantInfo* merchant){
    int index;
    if(!merchant)return;
    printf("shopType: %sn", merchant->type);
    printf("shopId: %lldn", merchant->id);
    printf("shopName: %sn", merchant->name);
    printf("shopPassword: %lldn", merchant->secret);
    printf("avgScore: %fn", merchant->score);
    printf("avePrice: %fn", merchant->price);
    printf("address: %sn", merchant->address);
    printf("phone: %sn", merchant->phone);
    for(index = 0; index<merchant->menu_size; index++)
        printf("food_id: %s, food_name: %s, food_price: %fn", merchant->menus[index].id, merchant->menus[index].name, merchant->menus[index].price);
    for(index = 0; index<merchant->remarks_size; index++)
        printf("Comment%d: %s", index, merchant->remarks[index]);
}

void trim(char *str)
{
    char* left = str;
    char* right = str;
    while(*right != ''){
        if(!isspace(*right)){
            *left++ = *right;
        }
        right ++;
    }
    *left = '';
}

/**
 * 散列表
**/
// 初始化哈希表
void HashInit(){
    merchants.size = 500;
    int index,j;
    for(index = 0; index<merchants.size; index++) {
        merchants.value[index] = (MerchantInfo*)malloc(sizeof(MerchantInfo));
        merchants.value[index]->next = NULL;
        for(j = 0; j<15; j++){
            merchants.value[index]->remarks[j] = NULL;
        }
    }
}

int hashKey(char name[]) {
    int key = 0;
    int index;
    for(index = 0; index<strlen(name); index++){
        key = (key * 5 + name[index]) % merchants.size;
    }
    if(key < 0) key = - key;
    return key;
}

void HashInsert(MerchantInfo* merchant){
    int key = hashKey(merchant->name);
    merchant->next = merchants.value[key]->next;
    merchants.value[key]->next = merchant;
}

void HashRemove(char* name){
    int key = hashKey(name);
    MerchantInfo* prev = merchants.value[key];
    MerchantInfo* curr = prev->next;
    while(curr){
        if(compare(curr->name, name)){
            prev->next = curr->next;
            free(curr);
            return;
        }
        prev = curr;
        curr = curr->next;
    }
}

void showHashTable() {
    MerchantInfo* curr = NULL;
    int index;
    for(index = 0; index<merchants.size; index++){
        curr = merchants.value[index]->next;
        while(curr){
            printShopInfo(curr);
            curr = curr->next;
        }
    }
}

// 拷贝节点
MerchantInfo* HashCopy(MerchantInfo* node){
    MerchantInfo* newNode = (MerchantInfo*)malloc(sizeof(MerchantInfo));
    strcpy(newNode->type, node->type);
    strcpy(newNode->name, node->name);
    strcpy(newNode->address, node->address);
    strcpy(newNode->phone, node->phone);
    newNode->menu_size = node->menu_size;
    newNode->remarks_size = node->remarks_size;
    newNode->secret = node->secret;
    newNode->price = node->price;
    newNode->id = node->id;
    newNode->score = node->score;
    int i;
    for(i = 0; i<node->menu_size; i++){
        strcpy(newNode->menus[i].id, node->menus[i].id);
        strcpy(newNode->menus[i].name, node->menus[i].name);
        newNode->menus[i].price = node->menus[i].price;
    }

    for(i = 0; i<node->remarks_size; i++){
        newNode->remarks[i] = strdup(node->remarks[i]);
    }
    return newNode;
}

void HashFree(MerchantInfo* node){
    int j;
    for(j = 0; j<node->remarks_size; j++){
        if(node->remarks[j]) {
            free(node->remarks[j]);
            node->remarks[j] = NULL;
        }
    }
    if(node)
        free(node);
    node = NULL;
}

void HashDestroy() {
    MerchantInfo *curr = NULL, *prev = NULL;
    int index, j;
    for(index = 0; index<merchants.size; index++){
        prev = merchants.value[index];
        while(prev) {
            curr = prev->next;
            HashFree(prev);
            prev = curr;
        }
    }
}

MerchantInfo* findHashTable(char* name){
    int key = hashKey(name);
    MerchantInfo* curr = merchants.value[key]->next;
    while(curr){
        if(compare(curr->name, name))
            return curr;
        curr = curr->next;
    }
    return NULL;
}

/**
 * 信息处理模块
**/
// 读取文件
void readConsumers() {
    int index = 0;
    char stringBuffer[100];
    FILE *fileIn = fopen(consumer_file,"r");
    if(fileIn == NULL){
        printf("user不存在n");
        return;
    }
    fgets(stringBuffer,100,fileIn);
    while(!feof(fileIn)) {
        fscanf(fileIn, "%s%s%s", consumers.value[index].account, consumers.value[index].password, consumers.value[index].phone);
        index ++;
    }
    consumers.size = index;
    fclose(fileIn);
}

void readIndents() {
    int index = 0;
    char stringBuffer[100];
    char *first = NULL, *last = NULL;
    FILE *fileIn = fopen(indent_file,"r");
    if(fileIn == NULL){
        printf("order.txt不存在n");
        return;
    }
    fgets(stringBuffer,100,fileIn);
    while(!feof(fileIn)) {
        fgets(stringBuffer, 100, fileIn);
        if(feof(fileIn))	break; 
        first = strchr(stringBuffer, ' ');
        last  = strrchr(stringBuffer, ' ');

        memcpy(indents.value[index].account, stringBuffer, first - stringBuffer);
        memcpy(indents.value[index].name, first, last - first);
        strcpy(indents.value[index].time, last+1);

        trim(indents.value[index].account);
        trim(indents.value[index].name);
        trim(indents.value[index].time);
        index ++;
    }
    indents.size = index;
    fclose(fileIn);
}

void readMerchants() {
	int  i;
    char stringBuffer[1000];
    MerchantInfo* merchant = NULL;
    FILE *fileIn = fopen(merchant_file,"r");
    if(fileIn == NULL){
        printf("shop.txt不存在n");
        return;
    }
    while(!feof(fileIn)) {
        fscanf(fileIn, "%s", stringBuffer);
        if(compare(stringBuffer, "shoptype:")) {
            if(merchant){
                HashInsert(merchant);
                merchant = NULL;
            }
            if(!merchant) {
                merchant = (MerchantInfo*)malloc(sizeof(MerchantInfo));
                merchant->menu_size = 0;
                merchant->remarks_size = 0;
                for(i = 0; i<15; i++){
                    merchant->remarks[i] = NULL;
                }
            }
            fscanf(fileIn, "%s", merchant->type);
        }else if(compare(stringBuffer, "shopId:")) {
            fscanf(fileIn, "%lld", &merchant->id);
        }else if(compare(stringBuffer, "shopName:")) {
            fscanf(fileIn, "%s", merchant->name);
        }else if(compare(stringBuffer, "shopPassword:")){
            fscanf(fileIn, "%lld", &merchant->secret);
        }else if(compare(stringBuffer, "avgScore:")) {
            fscanf(fileIn, "%f", &merchant->score);
        }else if(compare(stringBuffer, "avePrice:")) {
            fscanf(fileIn, "%f", &merchant->price);
        }else if(compare(stringBuffer, "address:")) {
            fscanf(fileIn, "%s", merchant->address);
        }else if(compare(stringBuffer, "phone:")) {
            fscanf(fileIn, "%s", merchant->phone);
        }else if(compare(stringBuffer, "food_id:")) {
            fscanf(fileIn, "%s", merchant->menus[merchant->menu_size].id);
            fscanf(fileIn, "%s%s", stringBuffer, merchant->menus[merchant->menu_size].name);
            fgetc(fileIn);
            fscanf(fileIn, "%s%f", stringBuffer, &merchant->menus[merchant->menu_size].price);
            merchant->menu_size ++;
        }else if(stringBuffer[0] == 'C') {
            fgets(stringBuffer, 1000, fileIn);
            merchant->remarks[merchant->remarks_size] = NULL;
            merchant->remarks[merchant->remarks_size++] = strdup(stringBuffer);
        }
    }
    fclose(fileIn);
}

void readDistances() {
    int index = 0;
    char stringBuffer[300];
    DistanceInfo dis;
    FILE *fileIn = fopen(distance_file,"r");
    if(fileIn == NULL){
        printf("distance.txt不存在n");
        return;
    }
    fgets(stringBuffer,300,fileIn);
    while(!feof(fileIn)) {
        fscanf(fileIn, "%d%s%d%s%f", &dis.id1, dis.name1, &dis.id2, dis.name2, &dis.distance);
        index ++;
    }
    distances.size = index;
    fclose(fileIn);
}

// 写入文件
void writeConsumers() {
    FILE* fileOut = fopen(consumer_file, "w");
    fprintf(fileOut, "用户账号t密码t联系方式n");
    int index;
    for(index = 0; index<consumers.size; index++){
        fprintf(fileOut, "%s %s %sn",consumers.value[index].account, consumers.value[index].password, consumers.value[index].phone);
    }
    fclose(fileOut);
}

void writeIndents() {
    FILE* fileOut = fopen(indent_file, "w");
    fprintf(fileOut, "用户账号t商家名称t预定时间n");
    int index;
    for(index = 0; index<indents.size; index++){
        fprintf(fileOut, "%s %s %sn",indents.value[index].account, indents.value[index].name, indents.value[index].time);
    }
    fclose(fileOut);
}

void writeMerchants() {
    FILE* fileOut = fopen(merchant_file, "w");
    MerchantInfo* merchant;
    int index;
    for(index = 0; index<merchants.size; index++){
        merchant = merchants.value[index]->next;
        while(merchant){
            fprintf(fileOut, "shoptype: %sn", merchant->type);
            fprintf(fileOut, "shopId: %lldn", merchant->id);
            fprintf(fileOut, "shopName: %sn", merchant->name);
            fprintf(fileOut, "shopPassword: %lldn", merchant->secret);
            fprintf(fileOut, "avgScore: %fn", merchant->score);
            fprintf(fileOut, "avePrice: %fn", merchant->price);
            fprintf(fileOut, "address: %sn", merchant->address);
            fprintf(fileOut, "phone: %sn", merchant->phone);
            int j;
            for(j = 0; j<merchant->menu_size; j++){
                fprintf(fileOut, "food_id: %s food_name: %s food_price: %fn", merchant->menus[j].id, merchant->menus[j].name, merchant->menus[j].price);
            }
            for(j = 0; j<merchant->remarks_size; j++){
                if(merchant->remarks[j])
                    fprintf(fileOut, "Comment%d: %s", j, merchant->remarks[j]);
            }
            merchant = merchant->next;
        }
    }
    fclose(fileOut);
}


/**
 * 用户子系统
**/

// 用户登陆
ConsumerInfo* consumerLogin() {
    char account[20], pwd[20];
    printf("请输入用户账号:");scanf("%s", account);
    printf("请输入用户密码:");scanf("%s", pwd);
    int index;
    for(index = 0; index<consumers.size; index++){
        if(compare(account, consumers.value[index].account) && compare(pwd, consumers.value[index].password) ){
            printf("登陆成功n");
            return &consumers.value[index];
        }
    }
    printf("登陆失败,账户或密码错误n");
    return NULL;
}

// 用户注册
void registerConsumer(){
    ConsumerInfo consumer;
    printf("请输入用户账户:");         scanf("%s", consumer.account);
    printf("请输入用户密码:");         scanf("%s", consumer.password);
    printf("请输入用户联系方式:");       scanf("%s",consumer.phone);
    consumers.value[consumers.size ++] = consumer;
    printf("注册用户成功n");
}

/* 个人信息管理 */
void showConsumerInfo(ConsumerInfo* info) {
    printf("账号:%s 联系方式:%sn",info->account, info->phone);
}

void updateConsumerInfo(ConsumerInfo* info) {
    int select;
    printf("1、修改密码 n");
    printf("2、修改联系方式 n");
    scanf("%d", &select);

    if(select == 1){
        scanf("%s", info->password);
    }else{
        scanf("%s", info->phone);
    }
}

void removeConsumerInfo(ConsumerInfo* info) {
    int i;
    int index = -1;
    for(i = 0; i<consumers.size; i++){
        if(compare(consumers.value[i].account, info->account)){
            index=i;
            break;
        }
    }
    if(index == -1){
        printf("不存在用户信息n");
        return ;
    }
    for(i = index; i<consumers.size-1; i ++){
        consumers.value[i] = consumers.value[i+1];
    }
    consumers.size --;
}




/* 餐馆查询 */
void merchantSearch() {
    char name[50];
    MerchantInfo* merchant;
    printf("请输入餐馆名称:"); scanf("%s", name);
    merchant = findHashTable(name);
    if(!merchant)
        printf("餐馆不存在n");
    else {
        printShopInfo(merchant);
        int index;
        for(index = 0; index<distances.size; index++){
            if(compare("郑州轻工业大学", distances.value[index].name1) && compare(name, distances.value[index].name2)){
                printf("用户到餐馆%s的距离为:%fn",name, distances.value[index].distance);
                return;
            }
        }
    }
}

/* 餐馆预定 */
void showConsumerBooking(ConsumerInfo* info) {
    int index;
    for(index = 0; index<indents.size; index++){
        if(compare(indents.value[index].account, info->account)){
            printf("用户账号:%s 商家名称:%s 预定时间:%sn", info->account, indents.value[index].name, indents.value[index].time);
        }
    }
}

void showConsumerBookingInMerchant(ConsumerInfo* info){
    int isBooking = 0;
    char name[50];
    MerchantInfo* merchant = NULL;
    printf("请输入餐馆名称:"); scanf("%s", name);
    merchant = findHashTable(name);
    if(!merchant){
        printf("餐馆不存在n");
        return;
    }else {
    	int index;
        for (index = 0; index < indents.size; index++) {
            if (compare(indents.value[index].account, info->account) && compare(indents.value[index].name, name)) {
                isBooking = 1;
                printf("用户账号:%s 商家名称:%s 预定时间:%sn", info->account, indents.value[index].name,indents.value[index].time);
            }
        }
    }
    if(!isBooking){
        printf("用户没有在该餐馆预定n");
    }
}

void merchantBooking(ConsumerInfo* info){
    IndentInfo indent;
    MerchantInfo* merchant = NULL;
    printf("请输入预定的餐馆:"); scanf("%s", indent.name);
    merchant = findHashTable(indent.name);
    if(merchant == NULL){
        printf("预定失败,餐馆不存在n");
    }else {
        strcpy(indent.account, info->account);
        printf("请输入预定时间:");
        scanf("%s", indent.time);
        indents.value[indents.size++] = indent;
        printf("预定成功!n");
    }
}

void consumerManage() {
    int select = 0;
    ConsumerInfo* info = consumerLogin();
    if(!info) return;
    while(1){
        printf("***********************************n");
        printf("*        1、查看个人信息             *n");
        printf("*        2、修改个人信息             *n");
        printf("*        3、注销个人信息             *n");
        printf("*        4、餐馆查询个人信息          *n");
        printf("*        5、查询用户所有预订          *n");
        printf("*        6、查询某餐馆的预订          *n");
        printf("*        7、添加预订                 *n");
        printf("*        0、退出                    *n");
        printf("***********************************n");
        printf("请输入选择【0-7】");   scanf("%d", &select);
        system("color 1A");
        switch(select){
            case 0:
                return;
            case 1:
                showConsumerInfo(info);
                break;
            case 2:
                updateConsumerInfo(info);
                break;
            case 3:
                removeConsumerInfo(info);
                return;
            case 4:
                merchantSearch();
                break;
            case 5:
                showConsumerBooking(info);
                break;
            case 6:
                showConsumerBookingInMerchant(info);
                break;
            case 7:
                merchantBooking(info);
                break;
            default:
                printf("输入错误n");
        }
    }
}



/**
 * 商家子系统
**/

// 商家登陆
char* merchantLogin() {
    long long id, pwd;
    char* name = (char*)malloc(sizeof(char) * 50);
    MerchantInfo* curr = NULL;
    printf("请输入商家账号:");scanf("%lld", &id);
    printf("请输入商家密码:");scanf("%lld", &pwd);
    int index;
    for(index = 0; index<merchants.size; index++){
        curr = merchants.value[index]->next;
        while(curr){
            if(curr->id == id && curr->secret == pwd){
                strcpy(name, curr->name);
                printf("登陆成功n");
                return name;
            }
            curr = curr->next;
        }
    }
    printf("账号或密码错误n");
    if(name)
        free(name);
    return NULL;
}

/* 餐馆信息管理 */
// 查询餐馆信息
void merchantInfoSearch(char* name) {
    MerchantInfo* merchant = NULL;
    merchant = findHashTable(name);
    if(!merchant){
        printf("餐馆不存在n");
    }else {
        printShopInfo(merchant);
    }
}

// 修改餐馆信息
char* merchantInfoUpdate(char* name) {
    int select ;
    MerchantInfo* info = NULL;
    MerchantInfo* merchant = findHashTable(name);
    if(!merchant) {
        printf("商家不存在n");
        return name;
    }

    printf("***********************************n");
    printf("*        1.修改商家类型             *n");
    printf("*        2.修改商家密码             *n");
    printf("*        3.修改商家人均消费          *n");
    printf("*        4.修改商家地址             *n");
    printf("*        5.修改商家电话             *n");
    printf("***********************************n");
    printf("请输入选择【1-6】:");  scanf("%d",&select);
    switch (select) {
        case 1:
            printf("请输入新的商家类型:");
            scanf("%s", merchant->type);
            break;
        case 2:
            printf("请输入新的商家密码:");
            scanf("%lld", &merchant->secret);
            break;
        case 3:
            printf("请输入新的商家人均消费:");
            scanf("%f", &merchant->price);
            break;
        case 4:
            printf("请输入新的商家地址:");
            scanf("%s", merchant->address);
            break;
        case 5:
            printf("请输入新的电话:");
            scanf("%s", merchant->phone);
            break;
        default:
            printf("修改失败n");
            break;
    }
    return name;
}

// 注销餐馆信息
void merchantInfoRemove(char* name) {
    HashRemove(name);
}

/* 餐馆预定信息管理 */
// 查询所有预定
void showRestaurantReserve(char* name) {
    int isBooking = 0;int index = 0;
    for(; index<indents.size; index++){
        if(compare(name, indents.value[index].name)){
            printf("%s %s %sn",indents.value[index].account, indents.value[index].name, indents.value[index].time);
            isBooking = 1;
        }
    }
    if(!isBooking){
        printf("该餐馆没有预约信息n");
    }
}

// 查询某用户预定
void showConsumerReserve(char* name) {
    char account[30];
    int isBooking = 0;
    printf("请输入用户账户:"); scanf("%s", account);int index = 0;
    for(; index<indents.size; index++){
        if(compare(account, indents.value[index].account) && compare(name, indents.value[index].name)){
            isBooking = 1;
            printf("%s %s %sn",indents.value[index].account, indents.value[index].name, indents.value[index].time);
        }
    }
    if(isBooking == 0)
        printf("该用户没有预定信息n");
}

// 处理预定
void dealingReserve(char* name) {
    int l = 0,r;
    int n;
    printf("请输入待处理预定个数:");  scanf("%d", &n);
    for(r = 0; r<indents.size && n; r++){
        if(!compare(indents.value[r].name, name)){
            indents.value[l++] = indents.value[r];
        }else n--;
    }
    while(r < indents.size){
        indents.value[l++] = indents.value[r++];
    }
    indents.size = l;
}

void merchantManage(){
    int select;
    char* name = NULL;
    name = merchantLogin();
    if(name == NULL)
        return;
    while(1){
        printf("*        1.查询餐馆信息             *n");
        printf("*        2.修改餐馆信息             *n");
        printf("*        3.注销餐馆信息             *n");
        printf("*        4.查询餐馆所有预定          *n");
        printf("*        5.查询某用户预定            *n");
        printf("*        6.处理预定                 *n");
        printf("*        0.退出商家子系统            *n");
        printf("请输入选择【0-6】:");    scanf("%d",&select);
        switch(select){
            case 0:
                if(name) free(name);
                return;
            case 1:
                merchantInfoSearch(name);
                break;
            case 2:
                name = merchantInfoUpdate(name);
                break;
            case 3:
                merchantInfoRemove(name);
                return;
            case 4:
                showRestaurantReserve(name);
                break;
            case 5:
                showConsumerReserve(name);
                break;
            case 6:
                dealingReserve(name);
                break;
            default:
                printf("输入错误n");
                break;
        }
    }

}

config.h文件(配置文件)

#ifndef CONFIG_H
#define CONFIG_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef long long LL;

typedef struct menuInfo {
    char id[50];
    char name[50];
    float price;
}MenuInfo;

typedef struct consumerInfo {
    char account[20];
    char password[20];
    char phone[20];
}ConsumerInfo;

typedef struct merchantInfo{
    char type[20];
    LL  id;
    char name[50];
    LL secret;
    float score;
    float price;
    char address[100];
    char phone[20];
    MenuInfo menus[100];
    int menu_size;
    char* remarks[15];
    int remarks_size;
    struct merchantInfo* next;
}MerchantInfo;

typedef struct indentInfo {
    char account[20];
    char name[100];
    char time [20];
}IndentInfo;

typedef struct distanceInfo {
    int id1;
    char name1[100];
    int id2;
    char name2[100];
    float distance;
}DistanceInfo;

typedef struct consumerInfoList {
    ConsumerInfo value[1000];
    int size;
}ConsumerInfoList;

typedef struct indentInfoList {
    IndentInfo value[1000];
    int size;
}IndentInfoList;

typedef struct distanceList {
    DistanceInfo value[1000];
    int size;
}DistanceList;

typedef struct merchantInfoTable {
    MerchantInfo* value[500];
    int size;
}MerchantInfoTable;


int compare(const char* str1, const char* str2);
void printShopInfo(MerchantInfo* s);
/**
 * 鏁e垪琛?
**/
// 鍒濆鍖栧搱甯岃〃
void HashInit();
// 鑾峰彇鍝堝笇鍊?
int hashKey(char name[]) ;
// 鎻掑叆鍝堝笇琛?
void HashInsert(MerchantInfo* s);
// 绉婚櫎鍝堝笇琛ㄤ腑鐨勫晢瀹朵俊鎭?
void HashRemove(char* name);
// 灞曠ず鍟嗗
void showHashTable() ;
// 閲婃斁鍝堝笇琛?
void HashDestroy() ;
// 鎷疯礉鑺傜偣
MerchantInfo* HashCopy(MerchantInfo*);
// 閲婃斁鑺傜偣
void HashFree(MerchantInfo*);
// 鏍规嵁鍟嗗鍚嶆煡鎵惧晢瀹朵俊鎭?
MerchantInfo* findHashTable(char* name);

/**
 * 淇℃伅澶勭悊妯″潡
**/
// 璇诲彇鏂囦欢
void readConsumers() ;

void readIndents() ;

void readMerchants() ;

void readDistances() ;

// 鍐欏叆鏂囦欢
void writeConsumers() ;

void writeIndents() ;

void writeMerchants() ;


/**
 * 鐢ㄦ埛瀛愮郴缁?
**/

// 鐢ㄦ埛鐧婚檰
ConsumerInfo * consumerLogin() ;
// 灞曠ず鐢ㄦ埛淇℃伅
void showConsumerInfo(ConsumerInfo*) ;
// 鏇存柊鐢ㄦ埛淇℃伅
void updateConsumerInfo(ConsumerInfo*) ;
// 娉ㄩ攢鐢ㄦ埛淇℃伅
void removeConsumerInfo(ConsumerInfo*) ;



/* 椁愰鏌ヨ */
void merchantSearch() ;

/* 椁愰棰勫畾 */
// 灞曠ず褰撳墠鐢ㄦ埛棰勫畾淇℃伅
void showConsumerBooking(ConsumerInfo*) ;
// 灞曠ず鐢ㄦ埛鍦ㄦ煇椁愰鐨勯瀹氫俊鎭?
void showConsumerBookingInMerchant(ConsumerInfo*);
// 灞曠ず椁愰鎵€鏈夐瀹氫俊鎭?
void merchantBooking(ConsumerInfo* u);
// 鐢ㄦ埛瀛愮郴缁?
void consumerManage() ;



/**
 * 鍟嗗瀛愮郴缁?
**/

// 鍟嗗鐧婚檰
char* merchantLogin() ;
/* 椁愰淇℃伅绠$悊 */
// 鏌ヨ椁愰淇℃伅
void merchantInfoSearch(char* name) ;
// 淇敼椁愰淇℃伅
char* merchantInfoUpdate(char* name);
// 娉ㄩ攢椁愰淇℃伅
void merchantInfoRemove(char* name);

/* 椁愰棰勫畾淇℃伅绠$悊 */
// 鏌ヨ鎵€鏈夐瀹?
void showRestaurantReserve(char* name) ;
// 鏌ヨ鏌愮敤鎴烽瀹?
void showConsumerReserve(char* name);
// 澶勭悊棰勫畾
void dealingReserve(char* name) ;
// 鍟嗗瀛愮郴缁?
void merchantManage();


// 鍒濆鍖?
void initDataInfo();

#endif //CONFIG_H

最后

以上就是聪慧毛衣为你收集整理的餐饮管理系统(C语言实现)的全部内容,希望文章能够帮你解决餐饮管理系统(C语言实现)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(53)

评论列表共有 0 条评论

立即
投稿
返回
顶部