电商系统之超管-管理员-商品(C语言)

2023-11-10 21:10

本文主要是介绍电商系统之超管-管理员-商品(C语言),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

大一暑假实训项目,主要对文件内容的增删改查,链表的基本应用。

编程小白,会的不多,只写了一些基本功能,函数大多是不带返回值的,避免错乱,简洁一些。

不过代码的健壮性还是不错滴。

代补功能:找回密码,各种信息独立修改。闲麻烦就没有打了OAO。

展示部分代码,如有错漏还望指正。


目录

文件存储格式

管理员 Administrator

超级管理员 SuperAdministrator

商品 MobilePhone

用户 Registering 

代码

提示注释和头文件及宏定义

结构体

函数原型

主函数

初始化超级管理员密码

超级管理员入口

管理员入口

注册管理员

注销管理员

修改管理员密码

查询用户

修改超级管理员密码

商品相关函数菜单

展示所有商品

添加商品

删除商品

修改商品价格

添加商品折扣

假二维码


文件存储格式

管理员 Administrator

依次:账号>密码>姓名>性别>电话号码


超级管理员 SuperAdministrator

依次:账号>密码,只有一个超级管理员。

 


商品 MobilePhone

依次:编号>品牌>价格>折扣>型号

 


用户 Registering 

依次:账号>密码>姓名>性别>电话号码>余额


代码

提示注释和头文件及宏定义

// fflush(stdin);
// 清空输入缓冲区// while((ch = getchar()) != '\n' && ch != EOF);
// 逐个读字符,遇到回车或者文本结尾为止
// 用于清空缓冲区// strspn(char * str_1, char * str_2)
// str_1 中的字符在 str_2 中, 则加 1
// 遇到第一个不在 str_2 中的字符, 则停止比较#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>  //便于生成随机数
#define SIZE 8    //定义数组大小
#define ch_1 "龖"  //用于生成仿二维码
#define ch_2 "  "  //二维码空白处
#define str "0123456789abcdefghijklmnopqrstuvwxyz"  //字母和数字

结构体

typedef struct superAdministrator  //超级管理员的结构体
{int account;  //超级管理员的账户 	int 6位数char password[SIZE*2];  //超级管理员的密码    int 9-15位数}SuperAdministrator;typedef struct administrtor  //管理员的结构体
{int account;  //管理员账号  6位char password[SIZE*2];  //密码  9-15位char name[SIZE];  //姓名char gender[SIZE];  //性别char telNum[SIZE*2];  //电话号码  11位struct administrtor * next;}Administrator;typedef struct mobile_phone  //手机的结构体
{int ID;  //编号  6位char type[SIZE];  //品牌  8位以内int price;  //价格double discount;  //折扣char name[SIZE*2];  //型号 小于16位struct mobile_phone * next;}MobilePhone;typedef struct customer  //顾客的结构体
{int account;  //顾客账号  6位char password[SIZE*2];  //密码  9-15位char name[SIZE];  //姓名char gender[SIZE];  //性别char telNum[SIZE*2];  //电话号码  11位int balance;  //用户余额struct customer * next;}customer;

函数原型

一共21个。

void Initial_super_administrator();  //初始化超级管理员
void loginSuperAdmin();  //超级管理员入口
void loginAdmin();  //管理员入口
void loginUser();  //用户入口
void createAdministrator();  //注册管理员
void removeAdministrator();  //注销管理员
void reviseAdministratorPassword();  //修改管理员密码
void SearrchCt();  //查询顾客
void changeSuAdminPassword();  //修改超级管理员密码
void relevant_Product();  //商品相关函数
void showInfo();  //展示所有商品信息
void addProduct();  //添加商品
void deleteProduct();  //删除商品
void reviseProduct();  //修改商品信息
void merchandiseDiscount();   //商品折扣
void input_error();  //输入错误显示
void file_open_error(FILE * fp);  //文件打开失败
void malloc_defeat(Administrator * A);  //动态内存申请失败
void admi_Destrong_List(Administrator * L);  //摧毁链表管理员
void prod_Destrong_List(MobilePhone * L);  //摧毁链表商品
void Payment_QR_code();  //支付二维码

主函数

int main()  //主函数
{Initial_super_administrator();  //初始化超级管理员while(1){char sel;  //选择char ch;  //用于清空缓冲区printf("||------------------------------------------||\n");printf("||     Welcome to Phone product system.     ||\n");printf("||------------------------------------------||\n");printf("||          【1】超级管理员登录             ||\n");printf("||          【2】管理员登录                 ||\n");printf("||          【0】退出                       ||\n");printf("||------------------------------------------||\n");printf("||   请选择: ");while((sel = getchar()) == '\n');  //不管输入什么都只读取第一个字符(除换行)while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区(清空第一个字符后的每一个字符)system("cls");  //清屏switch(sel){case '1':loginSuperAdmin();  //超级管理员入口break;case '2':loginAdmin();  //管理员入口break;case '0':printf("||------------------------------------------||\n");printf("||            系  统  已  关  闭            ||\n");printf("||------------------------------------------||\n");exit(0);default:input_error();  //输入错误显示}}return 0;
}

 


 

初始化超级管理员密码

主要是怕在某次测试中把密码忘了,每次都初始化,方便一些。不要也没关系。

void Initial_super_administrator()  //每次打开程序都会重新初始化超级管理员账号密码
{FILE * fp;const int account = 123456;  //常量避免值被修改const int password = 123456789;fp = fopen("SuperAdministrator.txt", "w");  //只写,无文件就创建文件file_open_error(fp);  //文件是否打开失败fprintf(fp, "%d\t%d\t", account, password);fclose(fp);  //关闭文件
}

超级管理员入口

void loginSuperAdmin()  //超级管理员入口
{char ch, sel;SuperAdministrator sa_1;  //超级管理员账号FILE * fp;  //文件指针int account;  //记录账号char password[SIZE*2];  //记录密码int len_1, len_2;  //记录密码个数, 记录密码合法字符个数while(1){while(1){printf("||------------------------------------------||\n");printf("||    输入 0 可取消登录, 请输入 6 位数字    ||\n");printf("||------------------------------------------||\n");printf("||  超级管理员账号:");scanf("%d", &account);system("cls");  //清屏if(account == 0)  //输入 0 返回上一级{return;}if(account<=100000 || account>999999)  //不是六位的数字{while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||      账号格式错误, 请输入 6 位数字       ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;  //账号格式正确}}while(1){printf("||------------------------------------------||\n");printf("||   输入 0 可取消登录, 9-15 位字母或数字   ||\n");printf("||------------------------------------------||\n");printf("||  超级管理员密码:");scanf("%s", password);system("cls");  //清屏if(strcmp(password, "0") == 0){return;}len_1 = strlen(password);len_2 = strspn(password, str);if(len_1<9 || len_1>15 || len_2<9 || len_2>15){while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||     密码格式错误, 9-15 位字母或数字      ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;}}fp = fopen("SuperAdministrator.txt", "r");  //只读,避免修改file_open_error(fp);  //文件是否打开失败fscanf(fp, "%d\t%s\t", &sa_1.account, sa_1.password);if(account != sa_1.account || strcmp(password, sa_1.password) != 0)  //账号或密码错误{printf("||------------------------------------------||\n");printf("||       账号或密码错误, 请重新输入         ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏fclose(fp);continue;}printf("||------------------------------------------||\n");printf("||              登  陆  成  功              ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏while(1){printf("||------------------------------------------||\n");printf("||        超  级  管  理  员  菜  单        ||\n");printf("||------------------------------------------||\n");printf("||          【1】注册管理员                 ||\n");printf("||          【2】注销管理员                 ||\n");printf("||          【3】修改管理员密码             ||\n");printf("||          【4】查询顾客                   ||\n");printf("||          【5】修改密码                   ||\n");printf("||          【6】商品相关菜单               ||\n");printf("||          【0】退出登录                   ||\n");printf("||------------------------------------------||\n");printf("||   请选择: ");while((sel = getchar()) == '\n');  //不管输入什么都只读取第一个字符(除换行)while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区(清空第一个字符后的每一个字符)system("cls");  //清屏switch(sel){case '1':createAdministrator();  //添加管理员break;case '2':removeAdministrator();  //删除管理员break;case '3':reviseAdministratorPassword();  //修改管理员密码break;case '4':SearrchCt();  //查询顾客break;case '5':changeSuAdminPassword();  //修改超级管理员密码return;case '6':relevant_Product();  //商品相关函数break;case '0':fclose(fp);  //关闭文件return;  //返回上一级default:input_error();  //输入错误显示}}}
}

 


 

管理员入口

void loginAdmin()  //管理员入口
{char ch, sel;int flag = 0;  //记录是否查找成功Administrator a_1;  //管理员账号 a_1FILE * fp;  //文件指针int account;char password[SIZE*2];  //存储输入的账号密码int len_1, len_2;  //记录密码个数, 记录密码合法字符个数while(1){while(1){printf("||------------------------------------------||\n");printf("||    输入 0 可取消登录, 请输入 6 位数字    ||\n");printf("||------------------------------------------||\n");printf("||  管理员账号:");scanf("%d", &account);system("cls");  //清屏if(account == 0)  //输入 0 返回上一级{return;}if(account<=100000 || account>999999)  //不是六位的数字{while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||      账号格式错误, 请输入 6 位数字       ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;  //账号格式正确}}while(1){printf("||------------------------------------------||\n");printf("||   输入 0 可取消登录, 9-15 位字母或数字   ||\n");printf("||------------------------------------------||\n");printf("||  管理员密码:");scanf("%s", password);system("cls");  //清屏if(strcmp(password, "0") == 0){return;}len_1 = strlen(password);len_2 = strspn(password, str);if(len_1<9 || len_1>15 || len_2<9 || len_2>15){while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||     密码格式错误, 9-15 位字母或数字      ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;}}fp = fopen("Administrator.txt", "r");  //打开文件file_open_error(fp);  //文件是否打开失败while(!feof(fp))  //文件指针到达末尾则返回 1{fscanf(fp, "%d\t%s\t%s\t%s\t%s\t\n", &a_1.account, a_1.password, a_1.name, a_1.gender, a_1.telNum);if(account == a_1.account && strcmp(password, a_1.password) == 0)  //账号密码都相同{flag = 1;  //登录成功break;}}if(flag == 0){printf("||------------------------------------------||\n");printf("||       账号或密码错误, 请重新输入         ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏fclose(fp);  //关闭文件continue;}printf("||------------------------------------------||\n");printf("||              登  陆  成  功              ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏while(1){printf("||------------------------------------------||\n");printf("||            管  理  员  菜  单            ||\n");printf("||------------------------------------------||\n");printf("||          【1】展示所有商品信息           ||\n");printf("||          【2】添加商品                   ||\n");printf("||          【3】删除商品                   ||\n");printf("||          【4】修改商品价格               ||\n");printf("||          【5】添加商品折扣               ||\n");printf("||          【6】查询顾客                   ||\n");printf("||          【0】退出登录                   ||\n");printf("||------------------------------------------||\n");printf("||   请选择: ");while((sel = getchar()) == '\n');  //不管输入什么都只读取第一个字符(除换行)while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区(清空第一个字符后的每一个字符)system("cls");  //清屏switch(sel){case '1':showInfo();  //展示所有商品信息system("pause");system("cls");break;case '2':addProduct();  //添加商品break;case '3':deleteProduct();  //删除商品break;case '4':reviseProduct();  //修改商品价格break;case '5':merchandiseDiscount();  //添加商品折扣break;case '6':SearrchCt();  //查询顾客break;case '0':fclose(fp);  //关闭文件return;  //返回上一级default:input_error();  //输入错误显示}}}
}

 


 

注册管理员

每次注册管理员,实际就是在文件末尾追加一个,账号用随机时生成,所以说,可能会出现账号相同的情况。

void createAdministrator()  //注册管理员
{srand((unsigned)time(NULL));  //种子库,成逐渐增大或逐渐减小char ch;Administrator a_1;  //管理员 a_1FILE * fp;int len_1, len_2;  //记录密码个数, 记录密码合法字符个数while(1){printf("||------------------------------------------||\n");printf("||     输入 0 可退出注册, 8 位以内字母      ||\n");printf("||------------------------------------------||\n");printf("||  管理员姓名: ");scanf("%s", a_1.name);system("cls");  //清屏if(strcmp(a_1.name, "0") == 0)  // 0 退出注册{return;}len_1 = strlen(a_1.name);if(len_1 < 8){break;}else{while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||       姓名格式不正确, 8 位以内字母       ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏}}while(1){printf("||------------------------------------------||\n");printf("||   输入 0 可退出注册, 请输入 11 位数字    ||\n");printf("||------------------------------------------||\n");printf("||  管理员手机号码: ");scanf("%s", a_1.telNum);system("cls");  //清屏if(strcmp(a_1.telNum, "0") == 0)  // 0 退出注册{return;}if(strspn(a_1.telNum, "0123456789") == 11){break;}else{while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||   手机号码格式不正确, 请输入 11 位数字   ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏}}while(1){printf("||------------------------------------------||\n");printf("||       输入 0 可退出注册, 男 或 女        ||\n");printf("||------------------------------------------||\n");printf("||  管理员性别: ");scanf("%s", a_1.gender);system("cls");  //清屏if(strcmp(a_1.gender, "0") == 0)  // 0 退出注册{return;}if(strcmp(a_1.gender, "男") == 0 || strcmp(a_1.gender, "女") == 0){break;}else{while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||      性别格式不正确, 请输入 男 或 女     ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏}}while(1){printf("||------------------------------------------||\n");printf("||   输入 0 可退出注册, 9-15 位字母或数字   ||\n");printf("||------------------------------------------||\n");printf("||   管理员密码:  ");scanf("%s", a_1.password);system("cls");  //清屏if(strcmp(a_1.password, "0") == 0){return;}len_1 = strlen(a_1.password);len_2 = strspn(a_1.password, str);if(len_1<9 || len_1>15 || len_2<9 || len_2>15){while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||     密码格式错误, 9-15 位字母或数字      ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;}}a_1.account = 100000 + rand()%900000;fp = fopen("Administrator.txt", "a");  //只写,在末尾添加file_open_error(fp);  //文件是否打开失败fprintf(fp, "%d\t%s\t%s\t%s\t%s\t\n", a_1.account, a_1.password, a_1.name, a_1.gender, a_1.telNum);printf("||------------------------------------------||\n");printf("||             注  册  成  功               ||\n");printf("||------------------------------------------||\n");printf("|| 账号:%-8d  密码:%-16s   ||\n", a_1.account, a_1.password);printf("|| 姓名: %-8s  性别:%-4s               ||\n", a_1.name, a_1.gender);printf("|| 联系方式:%-16s               ||\n", a_1.telNum);printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏fclose(fp);
}

注销管理员

void removeAdministrator()  //注销管理员
{char ch;int i = 0;int account;int len_1, len_2;  //记录密码个数, 记录密码合法字符个数char password[SIZE*2];Administrator * A;  //管理员Administrator * tail;  //指向尾部的指针FILE * fp;  //文件指针while(1){printf("||------------------------------------------||\n");printf("||    输入 0 可退出注销, 请输入 6 位数字    ||\n");printf("||------------------------------------------||\n");printf("||   管理员账号:  ");scanf("%d", &account);system("cls");  //清屏if(account == 0){return;}if(account<=100000 || account>999999){while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||      账号格式错误, 请输入 6 位数字       ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;}}while(1){printf("||------------------------------------------||\n");printf("||   输入 0 可退出注销, 9-15 位字母或数字   ||\n");printf("||------------------------------------------||\n");printf("||   管理员密码:  ");scanf("%s", password);system("cls");  //清屏if(strcmp(password, "0") == 0){return;}len_1 = strlen(password);len_2 = strspn(password, str);if(len_1<9 || len_1>15 || len_2<9 || len_2>15){while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||     密码格式错误, 9-15 位字母或数字      ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;}}A = (Administrator *)malloc(sizeof(Administrator));  //申请动态内存malloc_defeat(A);  //内存是否申请失败A->next = NULL;tail = A;  //指向尾部的指针fp = fopen("Administrator.txt", "r");  //可读写,写时清除原本内容file_open_error(fp);  //文件是否打开失败while(!feof(fp))  //fp==EOF 返回 1{Administrator * p;  //存放数据的指针p = (Administrator *)malloc(sizeof(Administrator));  //申请动态内存malloc_defeat(p);  //内存是否申请失败fscanf(fp,"%d\t%s\t%s\t%s\t%s\t\n", &p->account, p->password, p->name, p->gender, p->telNum);if((account == p->account) && (strcmp(password, p->password) == 0)){i = 1;  //删除计为 1continue;  //如果信息相同,则不接入链表}tail->next = p;  //接到表尾tail = p;  //循环至表尾tail->next = NULL;  //表尾表尾赋空}printf("||------------------------------------------||\n");if(i){printf("||             删  除  成  功               ||\n");}else{printf("||       无该管理员或管理员信息错误         ||\n");}printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏fclose(fp);if(i == 0){admi_Destrong_List(A);  //摧毁链表return;}fp = fopen("Administrator.txt", "w");  //可读写,写时清除原本内容file_open_error(fp);  //文件是否打开失败tail = A->next;  //指向尾部的指针while(tail != NULL){fprintf(fp,"%d\t%s\t%s\t%s\t%s\t\n", tail->account, tail->password, tail->name, tail->gender, tail->telNum);tail = tail->next;  //继续写入下一个}admi_Destrong_List(A);  //摧毁链表fclose(fp);  //关闭文件
}

修改管理员密码

修改密码都要双重认证新密码是否相同。

void reviseAdministratorPassword()  //修改管理员密码
{char ch;int i = 0;int account;int len_1, len_2;  //记录密码个数, 记录密码合法字符个数char password[SIZE*2];char password_1[SIZE*2], password_2[SIZE*2];FILE * fp;  //文件指针Administrator * A;  //管理员Administrator * tail;  //指向尾部的指针while(1){printf("||------------------------------------------||\n");printf("||   输入 0 即可取消修改, 请输入 6 位数字   ||\n");printf("||------------------------------------------||\n");printf("||   管理员账号:  ");scanf("%d", &account);system("cls");  //清屏if(account == 0){return;}if(account<=100000 || account>999999){while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||      账号格式错误, 请输入 6 位数字       ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;}}while(1){printf("||------------------------------------------||\n");printf("||   输入 0 可取消修改, 9-15 位字母或数字   ||\n");printf("||------------------------------------------||\n");printf("||   管理员密码:  ");scanf("%s", password);system("cls");  //清屏if(strcmp(password, "0") == 0){return;}len_1 = strlen(password);len_2 = strspn(password, str);if(len_1<9 || len_1>15 || len_2<9 || len_2>15){while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||     密码格式错误, 9-15 位字母或数字      ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;}}fp = fopen("Administrator.txt", "r");  //可读写file_open_error(fp);  //文件是否打开失败A = (Administrator *)malloc(sizeof(Administrator));  //申请动态内存malloc_defeat(A);  //内存是否申请失败A->next = NULL;tail = A;  //指向尾部的指针while(!feof(fp))  //fp==EOF 返回 1{Administrator * p;  //存放数据的指针p = (Administrator *)malloc(sizeof(Administrator));  //申请动态内存malloc_defeat(p);  //内存是否申请失败fscanf(fp, "%d\t%s\t%s\t%s\t%s\t\n", &p->account, p->password, p->name, p->gender, p->telNum);while((account == p->account)&&(strcmp(password, p->password) == 0))  //账号密码相同{while(1){printf("||------------------------------------------||\n");printf("||   输入 0 可取消修改, 9-15 位字母或数字   ||\n");printf("||------------------------------------------||\n");printf("||   新密码:  ");scanf("%s", password_1);system("cls");  //清屏if(strcmp(password_1, "0") == 0){return;}len_1 = strlen(password_1);len_2 = strspn(password_1, str);if(len_1<9 || len_1>15 || len_2<9 || len_2>15){while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||    新密码格式错误, 9-15 位字母或数字     ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;}}while(1){printf("||------------------------------------------||\n");printf("||   输入 0 可取消修改, 9-15 位字母或数字   ||\n");printf("||------------------------------------------||\n");printf("||   请再次输入新密码: ");scanf("%s", password_2);system("cls");  //清屏if(strcmp(password_2, "0") == 0){return;}len_1 = strlen(password_2);len_2 = strspn(password_2, str);if(len_1<9 || len_1>15 || len_2<9 || len_2>15){while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||    新密码格式错误, 9-15 位字母或数字     ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;}}if(strcmp(password_1, password_2) == 0){i = 1;strcpy(p->password, password_2);}else{printf("||------------------------------------------||\n");printf("||            密  码  不  相  同            ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏}}tail->next = p;  //接到表尾tail = p;  //循环至表尾tail->next = NULL;  //表尾表尾赋空}printf("||------------------------------------------||\n");if(i){printf("||             修  改  成  功               ||\n");}else{printf("||       无该管理员或管理员信息错误         ||\n");}printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏fclose(fp);if(i == 0){admi_Destrong_List(A);  //摧毁链表return;}fp = fopen("Administrator.txt", "w");  //可读写,写时清除原本内容file_open_error(fp);  //文件是否打开失败tail = A->next;  //指向尾部的指针while(tail != NULL){fprintf(fp,"%d\t%s\t%s\t%s\t%s\t\n", tail->account, tail->password, tail->name, tail->gender, tail->telNum);tail = tail->next;  //继续写入下一个}admi_Destrong_List(A);  //摧毁链表fclose(fp);  //释放文件指针
}

查询用户

根据用户姓名进行查询。目前只能用姓名,闲麻烦没有搞别的。

void SearrchCt()  //查询顾客
{customer u_1;  //顾客FILE * fp;char name[SIZE];fp = fopen("Registering.txt", "r");  //可读写file_open_error(fp);  //文件是否打开失败printf("||------------------------------------------||\n");printf("||   顾客姓名:  ");scanf("%s", name);system("cls");  //清屏while(!feof(fp))  //fp==EOF 返回 1{fscanf(fp,"%d\t%s\t%s\t%s\t%s\t%d\t\n",&u_1.account, u_1.password,u_1.name,u_1.gender,u_1.telNum, &u_1.balance);if(strcmp(name, u_1.name) == 0){printf("||------------------------------------------||\n");printf("|| 账号:%-8d  密码:%-16s   ||\n", u_1.account, u_1.password);printf("|| 姓名:%-8s  联系方式:%-11s    ||\n", u_1.name, u_1.telNum);printf("|| 性别:%-4s      余额:%-12d       ||\n", u_1.gender, u_1.balance);printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏fclose(fp);  //关闭文件return;}}printf("||------------------------------------------||\n");printf("||             无  此  顾  客               ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏fclose(fp);  //关闭文件
}

 


 

修改超级管理员密码

和修改管理员密码思路基本一致。

void changeSuAdminPassword()  //修改超级管理员密码
{char ch;char password_1[SIZE*2], password_2[SIZE*2];int len_1, len_2;  //记录密码个数, 记录密码合法字符个数SuperAdministrator sa_1;FILE * fp;fp = fopen("SuperAdministrator.txt", "r+");  //可读写,写时清除原本内容file_open_error(fp);  //文件是否打开失败fscanf(fp, "%d\t%s\t", &sa_1.account, sa_1.password);while(1){while(1){printf("||------------------------------------------||\n");printf("||   输入 0 可取消修改, 9-15 位字母或数字   ||\n");printf("||------------------------------------------||\n");printf("||   新密码:  ");scanf("%s", password_1);system("cls");  //清屏if(strcmp(password_1, "0") == 0){return;}len_1 = strlen(password_1);len_2 = strspn(password_1, str);if(len_1<9 || len_1>15 || len_2<9 || len_2>15){while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||    新密码格式错误, 9-15 位字母或数字     ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;}}while(1){printf("||------------------------------------------||\n");printf("||   输入 0 可取消修改, 9-15 位字母或数字   ||\n");printf("||------------------------------------------||\n");printf("||   请再次输入新密码: ");scanf("%s", password_2);system("cls");  //清屏if(strcmp(password_2, "0") == 0){return;}len_1 = strlen(password_2);len_2 = strspn(password_2, str);if(len_1<9 || len_1>15 || len_2<9|| len_2>15){while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||    新密码格式错误, 9-15 位字母或数字     ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;}}if(strcmp(password_1, password_2) == 0){strcpy(sa_1.password, password_2);fseek(fp, 0, SEEK_SET);fprintf(fp,"%d\t%s\t", sa_1.account, sa_1.password);printf("||------------------------------------------||\n");printf("||        修 改 成 功, 请 重 新 登 录       ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏break;}else{printf("||------------------------------------------||\n");printf("||            密  码  不  相  同            ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏}}fclose(fp);
}

商品相关函数菜单

就是选择对商品的操作。功能有点少了。

void relevant_Product()  //商品相关函数
{char ch, sel;while(1){printf("||------------------------------------------||\n");printf("||          商  品  相  关  菜  单          ||\n");printf("||------------------------------------------||\n");printf("||           【1】所有商品                  ||\n");printf("||           【2】添加商品                  ||\n");printf("||           【3】删除商品                  ||\n");printf("||           【4】修改商品价格              ||\n");printf("||           【5】添加商品折扣              ||\n");printf("||           【0】返回                      ||\n");printf("||------------------------------------------||\n");printf("||   请选择: ");while((sel = getchar()) == '\n');  //不管输入什么都只读取第一个字符(除换行)while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区(清空第一个字符后的每一个字符)system("cls");  //清屏switch(sel){case '1':showInfo();  //展示所有商品信息system("pause");system("cls");break;case '2':addProduct();  //添加商品break;case '3':deleteProduct();  //删除商品break;case '4':reviseProduct();  //修改商品价格break;case '5':merchandiseDiscount();  //添加商品折扣break;case '0':return;  //返回上一级default:input_error();  //输入错误显示}}
}

 


 

展示所有商品

void showInfo()  //展示所有商品信息
{FILE * fp;  //文件指针MobilePhone mp_1;fp = fopen("MobilePhone.txt", "r");  //只读,避免被修改file_open_error(fp);  //文件是否打开失败printf("||------------------------------------------||\n");printf("|| 编号      型号               价格    折扣||\n");while(!feof(fp)){fscanf(fp,"%d\t%s\t%d\t%lf\t%s\t\n", &mp_1.ID, mp_1.type, &mp_1.price, &mp_1.discount, mp_1.name);  //中转站printf("||%-8d%-7s%-15s%-8d%.2lf||\n", mp_1.ID, mp_1.type, mp_1.name, mp_1.price, mp_1.discount);}printf("||------------------------------------------||\n");fclose(fp);
}

 


 

添加商品

和注册管理员相似。

void addProduct()  //添加商品
{int len;char ch;FILE * fp;MobilePhone mp_1;while(1){printf("||------------------------------------------||\n");printf("||    输入 0 可取消添加, 请输入 6 位数字    ||\n");printf("||------------------------------------------||\n");printf("||    商品编号: ");scanf("%d", &mp_1.ID);system("cls");  //清屏if(mp_1.ID == 0)  //输入 0 返回上一级{return;}if(mp_1.ID<=100000 || mp_1.ID>999999)  //不是六位的数字{while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||      编号格式错误, 请输入 6 位数字       ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;  //账号格式正确}}while(1){printf("||------------------------------------------||\n");printf("||     输入 0 可取消添加, 8 位以内字母      ||\n");printf("||------------------------------------------||\n");printf("||     商品品牌: ");scanf("%s", mp_1.type);system("cls");  //清屏if(strcmp(mp_1.type, "0") == 0)  //输入 0 返回上一级{return;}len = strlen(mp_1.type);if(len >= 8){while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||        品牌格式错误, 8 位以内字母        ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;  //账号格式正确}}printf("||------------------------------------------||\n");printf("||    商品型号:  ");scanf("%s", mp_1.name);system("cls");  //清屏printf("||------------------------------------------||\n");printf("||    商品价格:  ");scanf("%d", &mp_1.price);system("cls");  //清屏mp_1.discount = 1.0;fp = fopen("MobilePhone.txt", "a");  //只写,追加file_open_error(fp);  //文件是否打开失败fprintf(fp,"%d\t%s\t%d\t%lf\t%s\t\n", mp_1.ID, mp_1.type, mp_1.price, mp_1.discount, mp_1.name);printf("||------------------------------------------||\n");printf("||             添  加  成  功               ||\n");printf("||------------------------------------------||\n");printf("|| 编号      型号               价格    折扣||\n");printf("||%-8d%-7s%-15s%-8d%.2lf||\n", mp_1.ID, mp_1.type, mp_1.name, mp_1.price, mp_1.discount);printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏fclose(fp);
}

删除商品

void deleteProduct()  //删除商品
{char ch;int i = 0;int ID;MobilePhone * MP;  //商品MobilePhone * tail;  //指向尾部的指针FILE * fp;  //文件指针MP = (MobilePhone *)malloc(sizeof(MobilePhone));  //申请动态内存if(MP == NULL){printf("||------------------------------------------||\n");printf("||          内  存  申  请  失  败          ||\n");printf("||------------------------------------------||\n");exit(0);}MP->next = NULL;tail = MP;  //指向尾部的指针fp = fopen("MobilePhone.txt", "r");  //可读写,写时清除原本内容file_open_error(fp);  //文件是否打开失败while(1){printf("||------------------------------------------||\n");printf("||    输入 0 可取消删除, 请输入 6 位数字    ||\n");printf("||------------------------------------------||\n");printf("||    商品编号: ");scanf("%d", &ID);system("cls");  //清屏if(ID == 0)  //输入 0 返回上一级{return;}if(ID<=100000 || ID>999999)  //不是六位的数字{while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||      编号格式错误, 请输入 6 位数字       ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;  //账号格式正确}}while(!feof(fp))  //fp==EOF 返回 1{MobilePhone * p;  //存放数据的指针p = (MobilePhone *)malloc(sizeof(MobilePhone));  //申请动态内存if(p == NULL){printf("||------------------------------------------||\n");printf("||          内  存  申  请  失  败          ||\n");printf("||------------------------------------------||\n");exit(0);}fscanf(fp,"%d\t%s\t%d\t%lf\t%s\t\n",&p->ID,p->type,&p->price,&p->discount,p->name);if(ID == p->ID){i = 1;  //删除计为 1continue;  //如果信息相同,则不接入链表}tail->next = p;  //接到表尾tail = p;  //循环至表尾tail->next = NULL;  //表尾表尾赋空}printf("||------------------------------------------||\n");if(i){printf("||             删  除  成  功               ||\n");}else{printf("||         无该商品或商品编号错误           ||\n");}printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏fclose(fp);if(i == 0)  //摧毁指针,并且返回{prod_Destrong_List(MP);  //销毁链表return;}fp = fopen("MobilePhone.txt", "w");  //可读写,写时清除原本内容file_open_error(fp);  //文件是否打开失败tail = MP->next;  //指向尾部的指针while(tail != NULL){fprintf(fp,"%d\t%s\t%d\t%lf\t%s\t\n", tail->ID, tail->type, tail->price, tail->discount, tail->name);tail = tail->next;  //继续写入下一个}prod_Destrong_List(MP);  //销毁链表fclose(fp);  //释放文件指针
}

修改商品价格

void reviseProduct()  //修改商品价格
{char ch;int i = 0;int ID;MobilePhone * MP;  //商品MobilePhone * tail;  //指向尾部的指针FILE * fp;  //文件指针MP = (MobilePhone *)malloc(sizeof(MobilePhone));  //申请动态内存if(MP == NULL){printf("||------------------------------------------||\n");printf("||          内  存  申  请  失  败          ||\n");printf("||------------------------------------------||\n");exit(0);}MP->next = NULL;tail = MP;  //指向尾部的指针while(1){printf("||------------------------------------------||\n");printf("||    输入 0 可取消修改, 请输入 6 位数字    ||\n");printf("||------------------------------------------||\n");printf("||    需改商品编号:");scanf("%d", &ID);system("cls");  //清屏if(ID == 0)  //输入 0 返回上一级{return;}if(ID<=100000 || ID>999999)  //不是六位的数字{while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||      编号格式错误, 请输入 6 位数字       ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;  //账号格式正确}}fp = fopen("MobilePhone.txt", "r");  //可读写file_open_error(fp);  //文件是否打开失败while(!feof(fp))  //fp==EOF 返回 1{MobilePhone * p;  //存放数据的指针p = (MobilePhone *)malloc(sizeof(MobilePhone));  //申请动态内存if(p == NULL){printf("||------------------------------------------||\n");printf("||          内  存  申  请  失  败          ||\n");printf("||------------------------------------------||\n");exit(0);}fscanf(fp,"%d\t%s\t%d\t%lf\t%s\t\n",&p->ID,p->type,&p->price,&p->discount,p->name);if(ID == p->ID)  //编号相同{printf("||------------------------------------------||\n");printf("||            修  改  后  价  格            ||\n");printf("||------------------------------------------||\n");printf("||    商品价格: ");scanf("%d", &p->price);system("cls");  //清屏i = 1;}tail->next = p;  //接到表尾tail = p;  //循环至表尾tail->next = NULL;  //表尾表尾赋空}printf("||------------------------------------------||\n");if(i){printf("||             修  改  成  功               ||\n");}else{printf("||         无该商品或商品编号错误           ||\n");}printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏fclose(fp);  //关闭文件if(i == 0)  //销毁链表,并且返回{prod_Destrong_List(MP);return;}fp = fopen("MobilePhone.txt", "w");  //可读写,写时清除原本内容file_open_error(fp);  //文件是否打开失败tail = MP->next;  //指向尾部的指针while(tail != NULL){fprintf(fp, "%d\t%s\t%d\t%lf\t%s\t\n", tail->ID, tail->type, tail->price, tail->discount, tail->name);tail = tail->next;  //继续写入下一个}prod_Destrong_List(MP);  //销毁链表fclose(fp);  //释放文件指针
}

添加商品折扣

用小数代替,相当于1是不打折,0.9是9折,以此类推。

void merchandiseDiscount()   //添加商品折扣
{char ch;int i = 0;int ID;MobilePhone * MP;  //商品MobilePhone * tail;  //指向尾部的指针FILE * fp;  //文件指针MP = (MobilePhone *)malloc(sizeof(MobilePhone));  //申请动态内存if(MP == NULL){printf("||------------------------------------------||\n");printf("||         内  存  申  请  失  败           ||\n");printf("||------------------------------------------||\n");exit(0);}MP->next = NULL;tail = MP;  //指向尾部的指针fp = fopen("MobilePhone.txt", "r");  //可读写file_open_error(fp);  //文件是否打开失败while(1){printf("||------------------------------------------||\n");printf("||    输入 0 可取消添加, 请输入 6 位数字    ||\n");printf("||------------------------------------------||\n");printf("||    商品编号: ");scanf("%d", &ID);system("cls");  //清屏if(ID == 0)  //输入 0 返回上一级{return;}if(ID<=100000 || ID>999999)  //不是六位的数字{while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区printf("||------------------------------------------||\n");printf("||      编号格式错误, 请输入 6 位数字       ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;  //账号格式正确}}while(!feof(fp))  //fp==EOF 返回 1{MobilePhone * p;  //存放数据的指针p = (MobilePhone *)malloc(sizeof(MobilePhone));  //申请动态内存if(p == NULL){printf("||------------------------------------------||\n");printf("||          内  存  申  请  失  败          ||\n");printf("||------------------------------------------||\n");exit(0);}fscanf(fp,"%d\t%s\t%d\t%lf\t%s\t\n",&p->ID,p->type,&p->price,&p->discount,p->name);if(ID == p->ID)  //编号相同{while(1){printf("||------------------------------------------||\n");printf("||        添 加 折 扣, 小 数(例: 0.9)       ||\n");printf("||------------------------------------------||\n");printf("||      折扣:  ");scanf("%lf", &p->discount);system("cls");  //清屏if(p->discount<=0 || p->discount>1){while((ch = getchar()) != '\n' && ch != EOF);  //清空缓冲区(清空第一个字符后的每一个字符)printf("||------------------------------------------||\n");printf("||    折扣格式错误, 请输入小于 1 的小数     ||\n");printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏continue;}else{break;}}i = 1;  //添加成功}tail->next = p;  //接到表尾tail = p;  //循环至表尾tail->next = NULL;  //表尾表尾赋空}printf("||------------------------------------------||\n");if(i){printf("||             添  加  成  功               ||\n");}else{printf("||         无该商品或商品编号错误           ||\n");}printf("||------------------------------------------||\n");system("pause");  //暂停system("cls");  //清屏fclose(fp);  //关闭文件if(i == 0)  //销毁链表,并且返回{prod_Destrong_List(MP);return;}fp = fopen("MobilePhone.txt", "w");  //可读写,写时清除原本内容file_open_error(fp);  //文件是否打开失败tail = MP->next;  //指向尾部的指针while(tail != NULL){fprintf(fp,"%d\t%s\t%d\t%lf\t%s\t\n", tail->ID, tail->type, tail->price, tail->discount, tail->name);tail = tail->next;  //继续写入下一个}prod_Destrong_List(MP);  //销毁链表fclose(fp);  //释放文件指针
}

假二维码

其实这个二维码只是一个用循环结合if语句一个格子一个格子的打印出来的图像,利用随机数,除了固定位置,其余位置每次打印都会不一样。

所以说,是扫不出来的哦。

不过这个函数在这个项目里面没有调用,原本是购买商品时的支付二维码和余额充值的支付二维码,属于是对用户的操作了,就没有调用。感兴趣的小伙伴可以复制打印一下。

void Payment_QR_code()  //支付二维码
{const int n = 25;int i, j;srand((unsigned)time(NULL));  //种子库,成逐渐增大或逐渐减小for(i = 1; i <= n; i++){for(j = 1; j <= n; j++){//定黑if((i==1&&j<=7)||(i==1&&j>=n-6)||(i==7&&j<=7)||(i==7&&j>=n-6)){printf(ch_1);continue;}if((j==1&&i<=7)||(j==1&&i>=n-6)||(j==7&&i<=7)||(j==7&&i>=n-6)){printf(ch_1);continue;}if(((i==n-6||i==n)&&j<=7)||((j==n-6||j==n)&&i<=7)){printf(ch_1);continue;}if((i==3||i==4||i==5||i==n-2||i==n-3||i==n-4)&&(j==3||j==4||j==5)){printf(ch_1);continue;}if((i==3||i==4||i==5)&&(j==3||j==4||j==5||j==n-2||j==n-3||j==n-4)){printf(ch_1);continue;}if((i==n-4||i==n-8)&&(j<=n-4&&j>=n-8)){printf(ch_1);continue;}if((j==n-4||j==n-8)&&(i<=n-4&&i>=n-8)){printf(ch_1);continue;}if(i==n-6&&j==n-6){printf(ch_1);continue;}//定白if(i==2&&((j>=2&&j<=6)||(j<=n-1&&j>=n-5))){printf(ch_2);continue;}if(i==6&&((j>=2&&j<=6)||(j<=n-1&&j>=n-5))){printf(ch_2);continue;}if(j==2&&((i>=2&&i<=6)||(i<=n-1&&i>=n-5))){printf(ch_2);continue;}if(j==6&&((i>=2&&i<=6)||(i<=n-1&&i>=n-5))){printf(ch_2);continue;}if(i==8&&(j<=8||j>=n-7)){printf(ch_2);continue;}if(j==8&&(i<=8||i>=n-7)){printf(ch_2);continue;}if(i==n-7&&((j<=8)||(j<=n-5&&j>=n-7))){printf(ch_2);continue;}if(j==n-7&&((i<=8)||(i<=n-5&&i>=n-7))){printf(ch_2);continue;}if(i==n-5&&((j<=8)||(j<=n-5&&j>=n-7))){printf(ch_2);continue;}if(j==n-5&&((i<=8)||(i<=n-5&&i>=n-7))){printf(ch_2);continue;}if(i==n-1&&(j<=6&&j>=2)){printf(ch_2);continue;}if(j==n-1&&(i<=6&&i>=2)){printf(ch_2);continue;}else  //随机{if(rand()%2){printf(ch_1);continue;}else{printf(ch_2);continue;}}}printf("\n");}system("pause");  //暂停system("cls");  //清屏
}

 


给个赞吧OAO,谢谢!

完结......

这篇关于电商系统之超管-管理员-商品(C语言)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/385262

相关文章

不懂推荐算法也能设计推荐系统

本文以商业化应用推荐为例,告诉我们不懂推荐算法的产品,也能从产品侧出发, 设计出一款不错的推荐系统。 相信很多新手产品,看到算法二字,多是懵圈的。 什么排序算法、最短路径等都是相对传统的算法(注:传统是指科班出身的产品都会接触过)。但对于推荐算法,多数产品对着网上搜到的资源,都会无从下手。特别当某些推荐算法 和 “AI”扯上关系后,更是加大了理解的难度。 但,不了解推荐算法,就无法做推荐系

基于人工智能的图像分类系统

目录 引言项目背景环境准备 硬件要求软件安装与配置系统设计 系统架构关键技术代码示例 数据预处理模型训练模型预测应用场景结论 1. 引言 图像分类是计算机视觉中的一个重要任务,目标是自动识别图像中的对象类别。通过卷积神经网络(CNN)等深度学习技术,我们可以构建高效的图像分类系统,广泛应用于自动驾驶、医疗影像诊断、监控分析等领域。本文将介绍如何构建一个基于人工智能的图像分类系统,包括环境

水位雨量在线监测系统概述及应用介绍

在当今社会,随着科技的飞速发展,各种智能监测系统已成为保障公共安全、促进资源管理和环境保护的重要工具。其中,水位雨量在线监测系统作为自然灾害预警、水资源管理及水利工程运行的关键技术,其重要性不言而喻。 一、水位雨量在线监测系统的基本原理 水位雨量在线监测系统主要由数据采集单元、数据传输网络、数据处理中心及用户终端四大部分构成,形成了一个完整的闭环系统。 数据采集单元:这是系统的“眼睛”,

嵌入式QT开发:构建高效智能的嵌入式系统

摘要: 本文深入探讨了嵌入式 QT 相关的各个方面。从 QT 框架的基础架构和核心概念出发,详细阐述了其在嵌入式环境中的优势与特点。文中分析了嵌入式 QT 的开发环境搭建过程,包括交叉编译工具链的配置等关键步骤。进一步探讨了嵌入式 QT 的界面设计与开发,涵盖了从基本控件的使用到复杂界面布局的构建。同时也深入研究了信号与槽机制在嵌入式系统中的应用,以及嵌入式 QT 与硬件设备的交互,包括输入输出设

JAVA智听未来一站式有声阅读平台听书系统小程序源码

智听未来,一站式有声阅读平台听书系统 🌟&nbsp;开篇:遇见未来,从“智听”开始 在这个快节奏的时代,你是否渴望在忙碌的间隙,找到一片属于自己的宁静角落?是否梦想着能随时随地,沉浸在知识的海洋,或是故事的奇幻世界里?今天,就让我带你一起探索“智听未来”——这一站式有声阅读平台听书系统,它正悄悄改变着我们的阅读方式,让未来触手可及! 📚&nbsp;第一站:海量资源,应有尽有 走进“智听

科研绘图系列:R语言扩展物种堆积图(Extended Stacked Barplot)

介绍 R语言的扩展物种堆积图是一种数据可视化工具,它不仅展示了物种的堆积结果,还整合了不同样本分组之间的差异性分析结果。这种图形表示方法能够直观地比较不同物种在各个分组中的显著性差异,为研究者提供了一种有效的数据解读方式。 加载R包 knitr::opts_chunk$set(warning = F, message = F)library(tidyverse)library(phyl

【区块链 + 人才服务】可信教育区块链治理系统 | FISCO BCOS应用案例

伴随着区块链技术的不断完善,其在教育信息化中的应用也在持续发展。利用区块链数据共识、不可篡改的特性, 将与教育相关的数据要素在区块链上进行存证确权,在确保数据可信的前提下,促进教育的公平、透明、开放,为教育教学质量提升赋能,实现教育数据的安全共享、高等教育体系的智慧治理。 可信教育区块链治理系统的顶层治理架构由教育部、高校、企业、学生等多方角色共同参与建设、维护,支撑教育资源共享、教学质量评估、

透彻!驯服大型语言模型(LLMs)的五种方法,及具体方法选择思路

引言 随着时间的发展,大型语言模型不再停留在演示阶段而是逐步面向生产系统的应用,随着人们期望的不断增加,目标也发生了巨大的变化。在短短的几个月的时间里,人们对大模型的认识已经从对其zero-shot能力感到惊讶,转变为考虑改进模型质量、提高模型可用性。 「大语言模型(LLMs)其实就是利用高容量的模型架构(例如Transformer)对海量的、多种多样的数据分布进行建模得到,它包含了大量的先验

软考系统规划与管理师考试证书含金量高吗?

2024年软考系统规划与管理师考试报名时间节点: 报名时间:2024年上半年软考将于3月中旬陆续开始报名 考试时间:上半年5月25日到28日,下半年11月9日到12日 分数线:所有科目成绩均须达到45分以上(包括45分)方可通过考试 成绩查询:可在“中国计算机技术职业资格网”上查询软考成绩 出成绩时间:预计在11月左右 证书领取时间:一般在考试成绩公布后3~4个月,各地领取时间有所不同

系统架构师考试学习笔记第三篇——架构设计高级知识(20)通信系统架构设计理论与实践

本章知识考点:         第20课时主要学习通信系统架构设计的理论和工作中的实践。根据新版考试大纲,本课时知识点会涉及案例分析题(25分),而在历年考试中,案例题对该部分内容的考查并不多,虽在综合知识选择题目中经常考查,但分值也不高。本课时内容侧重于对知识点的记忆和理解,按照以往的出题规律,通信系统架构设计基础知识点多来源于教材内的基础网络设备、网络架构和教材外最新时事热点技术。本课时知识