我是靠谱客的博主 背后老虎,最近开发中收集的这篇文章主要介绍C 杂志订阅管理系统,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

支持管理员和普通用户两种角色登录

支持用户注册和密码修改

支持杂志增删改查和统计

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <time.h>
///结构类型定义区
typedef struct _Magzine
{
char magid[20];
//杂志刊号,关键字,创建后不允许修改
char magname[30];	//杂志名称
char magunit[30];	//杂志单位
float price;
//单价
_Magzine() //默认构造函数进行初始化
{
memset(magid, 0, 20);
memset(magname, 0, 30);
memset(magunit, 0, 30);
price = 0;
}
}Magzine;
typedef struct _Customer
{
char account[20];//客户编号,也是账号,关键字,创建后不允许修改
char name[20];	//姓名
char sex[3];	//性别
char tel[12];	//电话
char unit[20];	//单位
char pwd[20];	//客户密码
_Customer() //默认构造函数进行初始化
{
memset(name,0,20);
memset(sex,0,3);
memset(tel,0,12);
memset(account,0,20);
memset(unit,0,20);
memset(pwd,0,20);
}
}Customer;
typedef struct _CMR
//客户订阅杂志关系结构
{
char account[20];	//客户编号
char magid[20];
//杂志刊号
int subsnum;
//订阅数量
char duetime[9];	//订阅期限,格式20210615(年月日)
_CMR() //默认构造函数进行初始化
{
memset(account, 0, 20);
memset(magid, 0, 20);
memset(duetime, 0, 9);
subsnum = 0;
}
}CMR;
//全局变量区
bool bmanagerlogin = false;
//全局变量,当前登录账户类型 true--管理员;false--普通用户
char useraccount[20] = {0}; //当前登录的普通用户账号,前提是bmanagerlogin为false
Customer customer[50]; //用户信息
--用户设定最多50个
int nCustomer = 0; //当前用户数量
Magzine magzine[20]; //杂志信息
-- 杂志设定最大20种
int nMagzine = 0;	//当前杂志数量
CMR cmr[1000];	//客户订阅杂志信息
int ncmr = 0;	//客户订阅杂志总数量
//函数区
//读取客户信息
void readcustomerinfo(FILE *fp)
{
char buf[200] = {0};
nCustomer = 0;
if(fgets(buf,200,fp) != NULL)
{
nCustomer = atoi(buf);
}
for(int i=0;i<nCustomer;i++)
{
if(fgets(buf, sizeof(buf), fp) != NULL)
{
sscanf(buf,"%st%st%st%st%st%s",
customer[i].account,
customer[i].name,
customer[i].sex,
customer[i].tel,
customer[i].unit,
customer[i].pwd);
}
else
{
nCustomer = i;
break;
}
}
}
//读取杂志信息
void readmagzineinfo(FILE *fp)
{
char buf[200] = {0};
nMagzine = 0;
if(fgets(buf,200,fp) != NULL)
{
nMagzine = atoi(buf);
}
for(int i=0;i<nMagzine;i++)
{
if(fgets(buf, sizeof(buf), fp) != NULL)
{
sscanf(buf,"%st%st%st%f",
magzine[i].magid,
magzine[i].magname,
magzine[i].magunit,
&magzine[i].price);
}
else
{
nMagzine = i;
break;
}
}
}
//读取客户订阅杂志信息
void readcmrinfo(FILE *fp)
{
char buf[200] = {0};
ncmr = 0;
if(fgets(buf,200,fp) != NULL)
{
ncmr = atoi(buf);
}
for(int i=0;i<ncmr;i++)
{
if(fgets(buf, sizeof(buf), fp) != NULL)
{
sscanf(buf,"%st%st%dt%s",
cmr[i].account,
cmr[i].magid,
&cmr[i].subsnum,
cmr[i].duetime);
}
else
{
ncmr = i;
break;
}
}
}
//读取文件信息
bool readfileinfo()
{
FILE *fp;
if((fp = fopen("customer.txt","r")) == NULL)
{
printf("customer.txt打开失败。");
}
else
{
readcustomerinfo(fp);
readmagzineinfo(fp);
readcmrinfo(fp);
fclose(fp);
return true;
}
return false;
}
//保存客户信息
void savecustomerinfo(FILE *fp)
{
fprintf(fp,"%dn",nCustomer);
for(int i=0;i<nCustomer;i++)
{
fprintf(fp, "%st%st%st%st%st%sn",
customer[i].account,
customer[i].name,
customer[i].sex,
customer[i].tel,
customer[i].unit,
customer[i].pwd);
}
}
//保存杂志信息
void savemagzineinfo(FILE *fp)
{
fprintf(fp,"%dn",nMagzine);
for(int i=0;i<nMagzine;i++)
{
fprintf(fp, "%st%st%st%fn",
magzine[i].magid,
magzine[i].magname,
magzine[i].magunit,
magzine[i].price);
}
}
//保存客户订阅杂志信息
void savecmrinfo(FILE *fp)
{
fprintf(fp,"%dn",ncmr);
for(int i=0;i<ncmr;i++)
{
fprintf(fp, "%st%st%dt%sn",
cmr[i].account,
cmr[i].magid,
cmr[i].subsnum,
cmr[i].duetime);
}
}
//保存文件信息
bool savefileinfo()
{
FILE *fp;
if((fp = fopen("customer.txt","w")) == NULL)
{
printf("customer.txt打开失败。");
}
else
{
savecustomerinfo(fp);
savemagzineinfo(fp);
savecmrinfo(fp);
fclose(fp);
return true;
}
return false;
}
//查询指定账号的用户信息
Customer *findcustomer(char account[20])
{
for(int i=0;i<nCustomer;i++)
{
if(strcmp(account,customer[i].account) == 0)
return customer+i;
}
return NULL;
}
Magzine *findmagzine(char magid[20])
{
for(int i=0;i<nMagzine;i++)
{
if(strcmp(magid,magzine[i].magid) == 0)
return magzine+i;
}
return NULL;
}
//管理员身份登录,首先校验账号密码;再显示功能菜单
bool managerlogin()
{
while(1)
{
system("cls");
char account[20] = {0};
char pwd[20] = {0};
printf("请输入账号:");
scanf("%s",account);
printf("请输入密码:");
getchar();
char c = 0;
int i = 0;
while(i < 20 )
{
c = getch();
if (c != 'n' && c != 'r')
{
pwd[i] = c;
putch('*');
i++;
}
else
break;
}
if(strcmp(account,"admin") != 0 || strcmp(pwd,"123456") != 0)
{
printf("n账号或密码输入错误,是否继续登录(N键退出,其它键继续):");
int c = getchar();
if(c == 'N' || c=='n')
return false;
continue;
}
bmanagerlogin = true;
return true;
}
}
bool finduserinfo(char *account,char *pwd)
{
for(int i=0;i<nCustomer;i++)
{
if(strcmp(account,customer[i].account) == 0 && strcmp(pwd,customer[i].pwd) == 0)
return true;
}
return false;
}
bool findcmr(char *useraccount,char *magid)
{
for(int i=0;i<ncmr;i++)
{
if(strcmp(cmr[i].account,useraccount) == 0 && strcmp(cmr[i].magid,magid) == 0)
return true;
}
return false;
}
bool userlogin()
{
while(1)
{
system("cls");
char account[20] = {0};
char pwd[20] = {0};
printf("请输入账号:");
scanf("%s",account);
printf("请输入密码:");
getchar();
char c = 0;
int i = 0;
while(i < 20 )
{
c = getch();
if (c != 'n' && c != 'r')
{
pwd[i] = c;
putch('*');
i++;
}
else
break;
}
if(!finduserinfo(account,pwd))
{
getchar();
printf("n账号或密码输入错误,是否继续登录(N键退出,其它键继续):");
int c = getchar();
if(c == 'N' || c=='n')
return false;
continue;
}
bmanagerlogin = false;
strcpy(useraccount,account);
return true;
}
return false;
}
//注册新的普通用户
void userreg()
{
printf("请输入新的用户账号:");
scanf("%s",customer[nCustomer].account);
if(findcustomer(customer[nCustomer].account) != NULL)
{
printf("账号已经被使用。n");
return;
}
printf("请输入新用户姓名:");
scanf("%s",customer[nCustomer].name);
printf("请输入新用户性别:");
scanf("%s",customer[nCustomer].sex);
printf("请输入新用户联系电话:");
scanf("%s",customer[nCustomer].tel);
printf("请输入新用户工作单位:");
scanf("%s",customer[nCustomer].unit);
//
printf("请输入新用户登录密码:");
char pwd[20] = {0};
char c = 0;
int i = 0;
while(i++ < 20 && c!= 'n' && c!='r')
{
c = getch();
pwd[i] = c;
putch('*');
}
strcpy(customer[nCustomer].pwd,pwd);
nCustomer++;
printf("n新用户注册完成。n");
}
bool systemlogin()
{
while(1)
{
system("cls");
printf("
欢迎使用杂志管理系统nn");
printf("
1、管理员登录n");
printf("
2、普通用户登录n");
printf("
3、普通用户注册n");
printf("
0、退出系统n");
printf("
n请输入您的选择:");
int sel = 0;
scanf("%d",&sel);
switch(sel)
{
case 1:
return managerlogin();
break;
case 2:
return userlogin();
break;
case 3:
userreg();
break;
case 0:
exit(0);
break;
}
system("pause");
}
return false;
}
void showmanagermenu()
{
system("cls");
printf("
欢迎使用杂志管理系统nn");
printf("
1、查看所有用户订阅杂志信息n");
printf("
2、重置用户登录密码n");
printf("
3、杂志信息管理n");
printf("
4、用户信息查询n");
printf("
5、显示所有信息n");
printf("
6、修改用户信息n");
printf("
7、删除过期订阅信息n");
printf("
8、订阅信息统计n");
printf("
0、退出系统n");
printf("
n请输入您的选择:");
}
void showusermenu()
{
system("cls");
printf("
欢迎使用杂志管理系统nn");
printf("
1、修改用户密码n");
printf("
2、显示所有杂志信息n");
printf("
3、杂志信息查询n");
printf("
4、查看已订阅杂志n");
printf("
5、订阅杂志n");
printf("
6、取消杂志订阅n");
printf("
0、退出系统n");
printf("
n请输入您的选择:");
}
void showallcustomerinfo()
{
printf("%20s%20s%20s%20s%20sn","用户账号","姓名","性别","联系电话","工作单位");
for(int i=0;i<nCustomer;i++)
{
printf("%20s%20s%20s%20s%20sn",customer[i].account,customer[i].name,customer[i].sex,customer[i].tel,customer[i].unit);
}
}
void showallmagzineinfo()
{
printf("%20s%20s%20s%20sn","杂志刊号","杂志名称","杂志单位","单价");
for(int i=0;i<nMagzine;i++)
{
printf("%20s%20s%20s%20.1fn",magzine[i].magid,magzine[i].magname,magzine[i].magunit,magzine[i].price);
}
}
void showallcmrinfo()
{
printf("%20s%20s%20s%20sn","用户姓名","杂志名称","订阅数量","订阅期限");
for(int i=0;i<ncmr;i++)
{
Customer *pC = findcustomer(cmr[i].account);
Magzine *pM = findmagzine(cmr[i].magid);
if (pC != NULL && pM != NULL)
printf("%20s%20s%20d%20sn",pC->name,pM->magname,cmr[i].subsnum,cmr[i].duetime);
}
}
void showallinfo()
{
system("cls");
printf("
*************用户信息*************nn");
showallcustomerinfo();
printf("n
*************杂志信息*************nn");
showallmagzineinfo();
printf("n
***********用户订阅信息***********nn");
showallcmrinfo();
}
void resetcustomerpwd()
{
system("cls");
printf("请输入要重置密码的用户账号:");
char account[20];
scanf("%s",account);
getchar();
Customer *p = findcustomer(account);
if(p==NULL)
printf("对不起,您输入的账号不存在。");
else
{
strcpy(p->pwd,"123456");
printf("密码重置完成。");
}
getchar();
}
void showcustomerinfo()
{
system("cls");
printf("请输入需要查询的用户账号:");
char account[20];
scanf("%s",account);
getchar();
Customer *p = findcustomer(account);
if(p == NULL)
printf("对不起,您输入的账号不存在。");
else
{
printf("用户帐号:%20sn",p->account);
printf("姓
名:%20sn",p->name);
printf("性
别:%20sn",p->sex);
printf("联系电话:%20sn",p->tel);
printf("工作单位:%20sn",p->unit);
}
}
void updatecustomerinfo()
{
system("cls");
printf("请输入需要修改信息的用户账号:");
char account[20];
scanf("%s",account);
getchar();
Customer *p = findcustomer(account);
if(p == NULL)
printf("对不起,您输入的账号不存在。");
else
{
while (1)
{
system("cls");
printf("
1、姓名
2、性别n");
printf("
3、联系电话
4、工作单位n");
printf("
0、结束修改n");
printf("n
请选择修改项:");
int sel;
scanf("%d", &sel);
getchar();
if (sel == 0)
return;
printf("请输入修改后的信息:");
switch (sel)
{
case 1:
scanf("%s", p->name);
break;
case 2:
scanf("%s", p->sex);
break;
case 3:
scanf("%s", p->tel);
break;
case 4:
scanf("%s", p->unit);
break;
case 0:
return;
}
}
}
}
//删除过期订阅信息
void removeoverdueinfo()
{
//cmr[500] ncmr
time_t timep;
struct tm *p;
time(&timep);
p = localtime(&timep);
char now[9] = { 0 };
sprintf(now, "%04d%02d%02d", p->tm_year + 1900, p->tm_mon+1, p->tm_mday);
printf("以下过期订阅信息被删除:n");
printf("%20s%20s%20s%20sn", "用户姓名", "杂志名称", "订阅数量", "订阅期限");
int t = 0;
for (int i = 0; i < ncmr; i++)
{
if (strcmp(cmr[i].duetime,now)>=0)
{
cmr[t++] = cmr[i];
}
else
{
Customer *pC = findcustomer(cmr[i].account);
Magzine *pM = findmagzine(cmr[i].magid);
printf("%20s%20s%20d%20sn", pC->name, pM->magname, cmr[i].subsnum, cmr[i].duetime);
}
}
ncmr = t;
}
void showstatmenu()
{
system("cls");
printf("
***************订阅信息统计***************nn");
printf("
1、各杂志订阅量及金额统计n");
printf("
2、各用户订阅量及金额统计n");
printf("
3、各杂志订阅性别订阅量及金额统计n");
printf("
4、各杂志订阅期限统计n");
printf("
0、结束统计n");
printf("n
请输入您的选择:");
}
//统计杂志订阅量及金额
void showmagsubs()
{
system("cls");
int i, j;
int subsnum[50] = { 0 };
for (i = 0; i < nMagzine; i++)
{
for (j = 0; j < ncmr; j++)
{
if (strcmp(cmr[j].magid, magzine[i].magid) == 0)
subsnum[i] += cmr[j].subsnum;
}
}
printf("%20s%10s%10s%10sn","杂志名称","订阅数量","单价","金额");
for (i = 0; i < nMagzine; i++)
{
if (subsnum[i] > 0)
printf("%20s%10d%10.1f%10.1fn", magzine[i].magname, subsnum[i], magzine[i].price, magzine[i].price*subsnum[i]);
}
}
//统计用户订阅量及金额
void showcustomersubs()
{
system("cls");
int i, j;
int subsnum[50] = { 0 };
float cost[50] = { 0 };
for (i = 0; i < nCustomer; i++)
{
for (j = 0; j < ncmr; j++)
{
if (strcmp(cmr[j].account, customer[i].account) == 0)
{
Magzine *pM = findmagzine(cmr[j].magid);
if (pM != NULL)
{
subsnum[i] += cmr[j].subsnum;
cost[i] += pM->price * cmr[j].subsnum;
}
}
}
}
printf("%20s%10s%10sn", "用户名称", "订阅数量", "金额");
for (i = 0; i < nCustomer; i++)
{
if (subsnum[i] > 0)
printf("%20s%10d%10.1fn", customer[i].name, subsnum[i], cost[i]);
}
}
//各杂志订阅用户性别订阅量及金额统计
void showsexsubs()
{
system("cls");
int i, j;
int subsnum[2] = { 0 };
float cost[2] = { 0 };
for (i = 0; i < nCustomer; i++)
{
for (j = 0; j < ncmr; j++)
{
if (strcmp(cmr[j].account, customer[i].account) == 0)
{
Magzine *pM = findmagzine(cmr[j].magid);
if (pM != NULL)
{
int s = 0;
if (strcmp(customer[i].sex, "女") == 0)
s = 1;
subsnum[s] += cmr[j].subsnum;
cost[s] += pM->price * cmr[j].subsnum;
}
}
}
}
printf("%10s%10s%10sn", "性别", "订阅数量", "金额");
printf("%10s%10d%10.1fn", "男", subsnum[0], cost[0]);
printf("%10s%10d%10.1fn", "女", subsnum[1], cost[1]);
}
void showoverduesubs()
{
system("cls");
printf("请输入需要查询的订阅有效日期(例如:20210618):");
char overdue[20];
scanf("%s", overdue);
getchar();
printf("n订阅期限在%s之前的订阅信息有:n", overdue);
printf("%20s%20s%20s%20sn", "用户姓名", "杂志名称", "订阅数量", "订阅期限");
for (int i = 0; i < ncmr; i++)
{
if (strcmp(cmr[i].duetime, overdue) < 0)
{
Customer *pC = findcustomer(cmr[i].account);
Magzine *pM = findmagzine(cmr[i].magid);
if (pC != NULL && pM != NULL)
{
printf("%20s%20s%20d%20sn", pC->name,pM->magname,cmr[i].subsnum,cmr[i].duetime);
}
}
}
}
//统计功能
void statcmrinfo()
{
while (1)
{
showstatmenu();
int sel;
scanf("%d", &sel);
switch (sel)
{
case 1:
//各杂志订阅量及金额统计
showmagsubs();
break;
case 2:
//各用户订阅量及金额统计
showcustomersubs();
break;
case 3:
//各杂志订阅用户性别订阅量及金额统计
showsexsubs();
break;
case 4:
//各杂志订阅期限统计
showoverduesubs();
break;
case 0:
//统计结束
return;
}
system("pause");
}
}
void showmagzinemanmenu()
{
system("cls");
printf("
***************杂志信息管理**************nn");
printf("
1、增加杂志
2、删除杂志n");
printf("
3、修改杂志
4、查询杂志n");
printf("
0、结束管理n");
printf("n
请输入您的选择:");
}
void addmagzine()
{
while (1)
{
printf("请输入新杂志刊号:");
scanf("%s", magzine[nMagzine].magid);
if (findmagzine(magzine[nMagzine].magid) != NULL)
printf("新杂志刊号已经存在,请重新输入。n");
else
break;
}
printf("请输入新杂志名称:");
scanf("%s", magzine[nMagzine].magname);
printf("请输入新杂志单位:");
scanf("%s", magzine[nMagzine].magunit);
printf("请输入新杂志单价:");
scanf("%f", &magzine[nMagzine].price);
nMagzine++;
printf("新杂志增加完成。n");
}
void removemagzine()
{
printf("请输入需要删除的杂志刊号:");
char magid[20];
scanf("%s", magid);
if (findmagzine(magid) == NULL)
printf("指定要删除的杂志刊号不存在。n");
int i,j;
//从杂志数组中删除指定刊号的杂志
for (i = 0; i < nMagzine; i++)
{
if (strcmp(magid, magzine[i].magid) == 0)
{
for (j = i; j < nMagzine; j++)
magzine[j] = magzine[j + 1];
nMagzine--;
break;
}
}
//从订阅信息中删除指定刊号杂志的订阅信息
for (i = 0; i < ncmr; i++)
{
if (strcmp(magid, cmr[i].magid) == 0)
{
for (j = i; j < ncmr; j++)
cmr[j] = cmr[j + 1];
ncmr--;
i--;
}
}
printf("删除杂志完成。n");
}
void updatemagzine()
{
printf("请输入需要删除的杂志刊号:");
char magid[20];
scanf("%s", magid);
Magzine *pM = findmagzine(magid);
if (pM == NULL)
printf("指定要删除的杂志刊号不存在。n");
else
{
while (1)
{
system("cls");
printf("
1、杂志名称
2、杂志单位n");
printf("
3、单价
0、结束修改n");
printf("n
请选择修改项:");
int sel;
scanf("%d", &sel);
getchar();
if (sel == 0)
return;
printf("请输入修改后的信息:");
switch (sel)
{
case 1:
scanf("%s", pM->magname);
break;
case 2:
scanf("%s", pM->magunit);
break;
case 3:
scanf("%f", &pM->price);
break;
case 0:
return;
}
}
}
}
void querymagzine()
{
printf("请输入需要查询的杂志刊号:");
char magid[20];
scanf("%s", magid);
Magzine *pM = findmagzine(magid);
if (pM == NULL)
printf("指定要查询的杂志刊号不存在。n");
else
{
printf("杂志刊号:%20sn", pM->magid);
printf("杂志名称:%20sn", pM->magname);
printf("杂志单位:%20sn", pM->magunit);
printf("单
价:%20gn", pM->price);
}
}
//杂志管理
void magzineman()
{
while (1)
{
showmagzinemanmenu();
int sel;
scanf("%d", &sel);
switch (sel)
{
case 1:
//增加杂志
addmagzine();
break;
case 2: //删除杂志
removemagzine();
break;
case 3:	//修改杂志
updatemagzine();
break;
case 4://查询杂志
querymagzine();
break;
case 0:
return;
}
system("pause");
}
}
void updateuserpwd()
{
Customer *pC = findcustomer(useraccount);
if(pC == NULL)
{
printf("错误:当前用户不存在。n");
return;
}
printf("请输入原密码:");
char pwd[20];
char c = 0;
int i = 0;
while(i < 20 )
{
c = getch();
if (c != 'n' && c != 'r')
{
pwd[i] = c;
putch('*');
i++;
}
else
break;
}
if(strcmp(pC->pwd,pwd)==0)
{
printf("n密码输入错误。n");
return;
}
printf("n请输入新密码:");
c = 0;
i = 0;
while(i < 20 )
{
c = getch();
if (c != 'n' && c != 'r')
{
pC->pwd[i] = c;
putch('*');
i++;
}
else
break;
}
printf("n密码修改完成。n");
}
void querysubsmagzine()
{
int i;
printf("%20s%20s%10s%10s%10sn","杂志刊号","杂志名称","订阅数量","单价","订阅期限");
for(i=0;i<ncmr;i++)
{
if(strcmp(cmr[i].account,useraccount) == 0)
{
Magzine *pM = findmagzine(cmr[i].magid);
if(pM != NULL)
printf("%20s%20s%10d%10.1f%10sn",pM->magid,pM->magname,cmr[i].subsnum,pM->price,cmr[i].duetime);
}
}
}
void subsmagzine()
{
printf("请输入需要订阅的杂志刊号:");
strcpy(cmr[ncmr].account,useraccount);
scanf("%s",cmr[ncmr].magid);
if(findmagzine(cmr[ncmr].magid) == NULL)
{
printf("指定的杂志不存在。n");
return;
}
if(findcmr(useraccount,cmr[ncmr].magid) != NULL)
{
printf("指定的杂志已经订阅。n");
return;
}
printf("请输入需要订阅的数量:");
scanf("%d",&cmr[ncmr].subsnum);
printf("请输入订阅期限(输入格式:20210617):");
scanf("%s",cmr[ncmr].duetime);
ncmr++;
printf("订阅成功。n");
}
void removecmr()
{
printf("请输入需要取消订阅的杂志刊号:");
char magid[20];
scanf("%s",magid);
int i,j;
int t = 0;
for (int i = 0; i < ncmr; i++)
{
//找到订阅信息
if(strcmp(useraccount,cmr[i].account) != 0 || strcmp(magid,cmr[i].magid) != 0)
cmr[t++] = cmr[i];
}
ncmr = t;
printf("杂志取消订阅完成。n");
}
void main()
{
system("mode con cols=120 lines=40");
if(!readfileinfo())
{
system("pause");
}
//进行系统登录,登录后才能使用系统
bool blogin = systemlogin();
if(blogin)
{
while(1)
{
//如果管理员登录,显示管理员功能
if(bmanagerlogin)
{
showmanagermenu();
int sel = 0;
scanf("%d", &sel);
getchar();
switch (sel)
{
case 1: //查看所有用户订阅杂志信息
system("cls");
showallcmrinfo();
break;
case 2:	//重置用户登录密码
resetcustomerpwd();
break;
case 3:	//杂志信息管理
magzineman();
break;
case 4:	//用户信息查询
showcustomerinfo();
break;
case 5:	//显示所有信息
showallinfo();
break;
case 6:	//修改用户信息
updatecustomerinfo();
break;
case 7:	//删除过期订阅信息
removeoverdueinfo();
break;
case 8:	//订阅信息统计
statcmrinfo();
break;
case 0:
{
getchar();
printf("是否需要保存用户信息(Y/N)?");
char c = getchar();
if (c == 'Y' || c == 'y')
savefileinfo();
exit(0);
}
}
system("pause");
}
else //否则普通用户登录显示普通用户功能
{
showusermenu();
int sel = 0;
scanf("%d", &sel);
switch (sel)
{
case 1:
//修改用户密码
updateuserpwd();
break;
case 2:
//显示所有杂志信息
showallmagzineinfo();
break;
case 3:
//杂志信息查询
querymagzine();
break;
case 4:
//查看已订阅杂志
querysubsmagzine();
break;
case 5:
//订阅杂志
subsmagzine();
break;
case 6:
//取消杂志订阅
removecmr();
break;
case 0:
{
getchar();
printf("是否需要保存用户信息(Y/N)?");
char c = getchar();
if (c == 'Y' || c == 'y')
savefileinfo();
exit(0);
}
}
system("pause");
}
}
}
}

最后

以上就是背后老虎为你收集整理的C 杂志订阅管理系统的全部内容,希望文章能够帮你解决C 杂志订阅管理系统所遇到的程序开发问题。

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

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

评论列表共有 0 条评论

立即
投稿
返回
顶部