C程序彩票管理系统项目
彩票管理系统是一个用于管理彩票销售和投注的系统,能够帮助彩票销售商更好地管理他们的彩票业务。在这个系统中,管理员可以添加、编辑、删除和查询彩票号码和彩票游戏。
本文将介绍一个基于C语言的彩票管理系统项目,该项目包括以下功能:
1. 添加、编辑、删除和查询彩票号码和彩票游戏
2. 添加、编辑、删除和查询彩票投注记录
3. 添加、编辑、删除和查询彩票销售记录
4. 管理员权限管理
下面是该项目的代码和架构:
1. 添加、编辑、删除和查询彩票号码和彩票游戏
“`
#include
#include
#include
#include
#define MAX_号码_LENGTH 100
// 彩票号码结构体
typedef struct {
char name[20];
char category[20];
char type[20];
int number;
}彩票号码;
// 彩票游戏结构体
typedef struct {
char name[20];
char category[20];
char type[20];
int number;
}彩票游戏;
// 彩票号码和游戏列表结构体
typedef struct {
彩票号码*号码;
彩票游戏*游戏;
}彩票列表;
// 添加彩票号码和游戏
void add_彩票号码_and_game(彩票列表* list, char* name, char* category, char* type, int number) {
彩票号码 new_号码;
new_号码.name = name;
new_号码.category = category;
new_号码.type = type;
new_号码.number = number;
list->号码 = &new_号码;
list->游戏 = &new_号码.游戏;
}
// 添加彩票游戏
void add_彩票游戏_and_game(彩票列表* list, char* name, char* category, char* type, int number) {
彩票游戏 new_游戏;
new_游戏.name = name;
new_游戏.category = category;
new_游戏.type = type;
new_游戏.number = number;
list->号码 = &new_游戏;
list->游戏 = &new_游戏.游戏;
}
// 查询彩票号码和游戏
彩票号码* query_彩票号码_and_game(彩票列表* list, char* name, char* category, char* type, int number) {
彩票号码* result = NULL;
if (list->号码 == NULL) {
result = (彩票号码*)malloc(sizeof(彩票号码));
strcpy(result->name, name);
strcpy(result->category, category);
strcpy(result->type, type);
strcpy(result->number, number);
list->号码 = result;
}
if (list->游戏 == NULL) {
result = (彩票游戏*)malloc(sizeof(彩票游戏));
strcpy(result->name, name);
strcpy(result->category, category);
strcpy(result->type, type);
strcpy(result->number, number);
list->游戏 = result;
}
return result;
}
// 查询彩票销售记录
彩票销售记录* query_彩票销售记录(彩票列表* list, char* name, char* category, char* type, int number) {
彩票销售记录* result = NULL;
if (list->号码 == NULL) {
result = (彩票销售记录*)malloc(sizeof(彩票销售记录));
strcpy(result->name, name);
strcpy(result->category, category);
strcpy(result->type, type);
strcpy(result->number, number);
list->号码 = result;
}
if (list->游戏 == NULL) {
result = (彩票销售记录*)malloc(sizeof(彩票销售记录));
strcpy(result->name, name);
strcpy(result->category, category);
strcpy(result->type, type);
strcpy(result->number, number);
list->游戏 = result;
}
return result;
}
// 添加、编辑、删除和查询管理员权限
void add_admin_rights(彩票列表* list, char* name, char* category, char* type, int number) {
if (list->号码 == NULL || list->游戏 == NULL) {
printf(\”请输入管理员的用户名和密码:\”);
char user_name[20];
char password[20];
scanf(\”%s%s%s%s\”, user_name, password, name, category, type);
list->号码 = (彩票号码*)malloc(sizeof(彩票号码));
strcpy(list->号码->name, user_name);
strcpy(list->号码->category, category);
strcpy(list->号码->type, type);
strcpy(list->号码->number, number);
list->号码->number = number + 1;
list->游戏 = (彩票游戏*)malloc(sizeof(彩票游戏));
strcpy(list->游戏->name, user_name);
strcpy(list->游戏->category, category);
strcpy(list->游戏->type, type);
strcpy(list->游戏->number, number);
list->游戏->number = number + 1;
list->游戏->number = number + 1;
printf(\”管理员权限已添加!\\n\”);
} else {
printf(\”请输入管理员的用户名和密码:\”);
char user_name[20];
char password[20];
scanf(\”%s%s%s%s\”, user_name, password, name, category, type);
list->号码 = (彩票号码*)malloc(sizeof(彩票号码));
strcpy(list->号码->name, user_name);
strcpy(list->号码->category, category);
strcpy(list->号码->type, type);
strcpy(list->号码->number, number);
list->号码->number = number + 1;
list->游戏 = (彩票游戏*)malloc(sizeof(彩票游戏));
strcpy(list->游戏->name, user_name);
strcpy(list->游戏->category
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。