一.系统管理员
创建,删除账号
设置VIP玩家及封号
查询用户信息
修改自身账户信息
二.普通管理员
添加删除装备英雄
修改装备英雄
查询装备英雄
修改自身账户信息
三.玩家
查看英雄装备信息
修改自身账户信息
四.VIP玩家
精确查询英雄装备信息
条件查询英雄装备信息
多条件查询英雄装备信息
五.封号玩家
无法登陆
#include
#include
#include
struct Hero{//定义英雄链表
char name[22];
char sex[10];
char type[10];
char profession[10];
char place[22];
int money;
struct Hero *next;
};typedef struct Hero LNodeHero,*LinkListHero;
struct Weapon{//定义装备列表
char Weapon_name[30];
int Weapon_Attack;
int Weapon_HP;
int Weapon_Sp;
int Weapon_Mp;
int Weapon_CD;
int Weapon_Magic;
int Weapon_AttackSpeed;
int Weapon_Speed;
int Weapon_SuperAttack;
struct Weapon *Weapon_next;
};typedef struct Weapon LNodeWeapon,*LinkListWeapon;
struct User{//定义用户链表
char User_name[22];
char User_id[10];
char User_password[5];
int User_money;
int User_HeroNum;
int User_credit;
char User_status[25];
struct User *User_next;
};typedef struct User LNodeUser,*LinkListUser;
void CreateListHero(LinkListHero headHero)//创建英雄链表
{
LinkListHero p,rear=headHero;
char nameA[22];
char sexA[10];
char typeA[10];
char professionA[10];
char placeA[22];
int moneyA;
freopen("英雄.txt","r",stdin);
while(scanf("%s",nameA),strlen(nameA)!=1)
{
scanf("%s%s%s%s%d",sexA,typeA,professionA,placeA,&moneyA);
p=(LinkListHero)malloc(sizeof(LNodeHero));
strcpy(p->name,nameA);
strcpy(p->sex,sexA);
strcpy(p->type,typeA);
strcpy(p->profession,professionA);
strcpy(p->place,placeA);
p->money=moneyA;
rear->next=p;
rear=p;
}
rear->next=NULL;
fclose(stdin);
}void CreateListWeapon(LinkListWeapon headWeapon)//创建装备链表
{
LinkListWeapon p,rear=headWeapon;
char Weapon_nameA[30];
int Weapon_AttackA;
int Weapon_HpA;
int Weapon_SpA;
int Weapon_MpA;
int Weapon_CDA;
int Weapon_MagicA;
int Weapon_AttackSpeedA;
int Weapon_SpeedA;
int Weapon_SuperAttackA;
freopen("装备.txt","r",stdin);
while(scanf("%s",Weapon_nameA),strlen(Weapon_nameA)!=1)
{
scanf("%d",&Weapon_AttackA);
scanf("%d",&Weapon_HpA);
scanf("%d",&Weapon_SpA);
scanf("%d",&Weapon_MpA);
scanf("%d",&Weapon_CDA);
scanf("%d",&Weapon_MagicA);
scanf("%d",&Weapon_AttackSpeedA);
scanf("%d",&Weapon_SpeedA);
scanf("%d",&Weapon_SuperAttackA);
p=(LinkListWeapon)malloc(sizeof(LNodeWeapon));
strcpy(p->Weapon_name,Weapon_nameA);
p->Weapon_Attack=Weapon_AttackA;
p->Weapon_HP=Weapon_HpA;
p->Weapon_Sp=Weapon_SpA;
p->Weapon_Mp=Weapon_MpA;
p->Weapon_CD=Weapon_CDA;
p->Weapon_Magic=Weapon_MagicA;
p->Weapon_AttackSpeed=Weapon_AttackSpeedA;
p->Weapon_Speed=Weapon_SpeedA;
p->Weapon_SuperAttack=Weapon_SuperAttackA;
rear->Weapon_next=p;
rear=p;
}
rear->Weapon_next=NULL;
fclose(stdin);
}void CreateListUser(LinkListUser headUser)//创建用户链表
{
LinkListUser p,rear=headUser;
char User_nameA[22];
char User_idA[10];
char User_passwordA[5];
int User_moneyA;
int User_HeroNumA;
int User_creditA;
char User_statusA[25];
freopen("用户.txt","r",stdin);
while(scanf("%s",User_nameA),strlen(User_nameA)!=1)
{
scanf("%s%s%d%d%d%s",User_idA,User_passwordA,&User_moneyA,&User_HeroNumA,&User_creditA,User_statusA);
p=(LinkListUser)malloc(sizeof(LNodeUser));
strcpy(p->User_name,User_nameA);
strcpy(p->User_id,User_idA);
strcpy(p->User_password,User_passwordA);
p->User_money=User_moneyA;
p->User_HeroNum=User_HeroNumA;
p->User_credit=User_creditA;
strcpy(p->User_status,User_statusA);
rear->User_next=p;
rear=p;
}
rear->User_next=NULL;
fclose(stdin);
}void PrintListHero(LinkListHero headHero)//打印所有英雄
{
LinkListHero p=headHero->next;
while(p)
{
printf("姓名:%s ",p->name);
printf("性别:%s ",p->sex);
printf("类型:%s ",p->type);
printf("职业:%s ",p->profession);
printf("地域:%-13s ",p->place);
printf("价格:%d\n",p->money);
p=p->next;
}
}void PrintListWeapon(LinkListWeapon headWeapon)//打印所有装备
{
LinkListWeapon p=headWeapon->Weapon_next;
while(p)
{
printf("名 称:%s ",p->Weapon_name);
printf("攻 击:%d ",p->Weapon_Attack);
printf("生 命 值:%d ",p->Weapon_HP);
printf("护 甲:%d ",p->Weapon_Sp);
printf("魔 抗:%d ",p->Weapon_Mp);
printf("CD 减 免:%d ",p->Weapon_CD);
printf("法 强:%d ",p->Weapon_Magic);
printf("攻 速:%d ",p->Weapon_AttackSpeed);
printf("移 速:%d ",p->Weapon_Speed);
printf("暴 击:%d\n",p->Weapon_SuperAttack);
p=p->Weapon_next;
}
}void PrintListUser(LinkListUser headUser)//系统管理员调阅所有用户信息
{
LinkListUser p=headUser->User_next;
while(p)
{
printf("姓名:%s ",p->User_name);
printf("账号:%s ",p->User_id);
printf("资产:%d ",p->User_money);
printf("英雄数量:%d ",p->User_HeroNum);
printf("信用值:%d ",p->User_credit);
printf("身份:%s ",p->User_status);
p=p->User_next;
}
}int UserLogin(LinkListUser headUser,char User_idA[],char InputPassword[])//判断用户身份
{
LinkListUser p=headUser->User_next;
int i=0;
while(p)
{
if(strcmp(User_idA,p->User_id)==0)
{
i++;
if(strcmp(InputPassword,p->User_password)==0)
{
i++;
if(strcmp(p->User_status,"系统管理员")==0)
return 1;
if(strcmp(p->User_status,"普通管理员")==0)
return 2;
if(strcmp(p->User_status,"玩家")==0)
return 3;
if(strcmp(p->User_status,"VIP玩家")==0)
return 4;
if(strcmp(p->User_status,"封号玩家")==0)
return 5;
}
break;
}
p=p->User_next;
}
if(i==0)
return 6;
if(i==1)
return 7;
}void Personal(LinkListUser headUser,char User_idA[])//个人主页
{
LinkListUser p=headUser->User_next;
while(p)
{
if(strcmp(User_idA,p->User_id)==0)
{
printf("*******************\n");
printf("姓 名:%s\n",p->User_name);
printf("账 号:%s\n",p->User_id);
printf("资 产:%d\n",p->User_money);
printf("英雄数量:%d\n",p->User_HeroNum);
printf("信 用 值:%d\n",p->User_credit);
printf("身 份:%s\n",p->User_status);
printf("*******************\n");
break;
}
p=p->User_next;
}
}void AmendListHero(LinkListHero headHero)//管理员修改英雄信息
{
LinkListHero p=headHero->next;
char nameA[22];
char sexA[10];
char typeA[10];
char professionA[10];
char placeA[22];
int moneyA;
int count;
printf("输入要修改英雄姓名:\n");
scanf("%s",nameA);
while(p)
{
if(strcmp(nameA,p->name)==0)
{
count++;
char nameB[22];
printf("输入修改后姓名:\n");
scanf("%s",nameB);
printf("输入要修改英雄性别:\n");
scanf("%s",sexA);
printf("输入要修改英雄类型:\n");
scanf("%s",typeA);
printf("输入要修改英雄职业:\n");
scanf("%s",professionA);
printf("输入要修改英雄地域:\n");
scanf("%s",placeA);
printf("输入要修改英雄价格:\n");
scanf("%d",&moneyA);
strcpy(p->name,nameB);
strcpy(p->sex,sexA);
strcpy(p->type,typeA);
strcpy(p->profession,professionA);
strcpy(p->place,placeA);
p->money=moneyA;
break;
}
p=p->next;
}
if(count==0){
printf("无此英雄\n");
}
}void AmendListWeapon(LinkListWeapon headWeapon)//管理员修改装备信息
{
LinkListWeapon p=headWeapon->Weapon_next;
int count=0;
char Weapon_nameA[30];
int Weapon_AttackA;
int Weapon_HpA;
int Weapon_SpA;
int Weapon_MpA;
int Weapon_CDA;
int Weapon_MagicA;
int Weapon_AttackSpeedA;
int Weapon_SpeedA;
int Weapon_SuperAttackA;
printf("输入要修改装备名称:");
scanf("%s",Weapon_nameA);
while(p)
{
if(strcmp(Weapon_nameA,p->Weapon_name)==0)
{
count++;
printf("输入修改后的装备攻击:");
scanf("%d",&Weapon_AttackA);
printf("输入修改后的装备生命值:");
scanf("%d",&Weapon_HpA);
printf("输入修改后的装备护甲:");
scanf("%d",&Weapon_SpA);
printf("输入修改后的装备魔抗:");
scanf("%d",&Weapon_MpA);
printf("输入修改后的装备CD:");
scanf("%d",&Weapon_CDA);
printf("输入修改后的装备法强:");
scanf("%d",&Weapon_MagicA);
printf("输入修改后的装备攻速:");
scanf("%d",&Weapon_AttackSpeedA);
printf("输入修改后的装备移速:");
scanf("%d",&Weapon_SpeedA);
printf("输入修改后的装备暴击:");
scanf("%d",&Weapon_SuperAttackA);
strcpy(p->Weapon_name,Weapon_nameA);
p->Weapon_Attack=Weapon_AttackA;
p->Weapon_HP=Weapon_HpA;
p->Weapon_Sp=Weapon_SpA;
p->Weapon_Mp=Weapon_MpA;
p->Weapon_CD=Weapon_CDA;
p->Weapon_Magic=Weapon_MagicA;
p->Weapon_AttackSpeed=Weapon_AttackSpeedA;
p->Weapon_Speed=Weapon_SpeedA;
p->Weapon_SuperAttack=Weapon_SuperAttackA;
printf("修改成功\n");
break;
}
p=p->Weapon_next;
}
if(count==0){
printf("无此英雄\n");
}
}void AmendListUser(LinkListUser headUser,char InputId[])//用户修改个人信息
{
LinkListUser p=headUser->User_next;
char User_nameA[22];
char User_passwordA[5];
printf("输入新的昵称:");
scanf("%s",User_nameA);
printf("输入3位新的密码:");
scanf("%s",User_passwordA);
while(p)
{
if(strcmp(InputId,p->User_id)==0)
{
strcpy(p->User_name,User_nameA);
strcpy(p->User_password,User_passwordA);
break;
}
p=p->User_next;
}
printf("修改成功\n");
}void VIP(LinkListUser headUser)//系统管理员设置VIP玩家
{
LinkListUser p=headUser->User_next;
int num;
printf("输入VIP玩家英雄数量底限:");
scanf("%d",&num);
while(p)
{
if(p->User_HeroNum>=num)
{
strcmp(p->User_status,"VIP玩家");
break;
}
p=p->User_next;
}
printf("VIP玩家设置成功\n");
}void Freeze(LinkListUser headUser)//系统管理员对玩家进行封号
{
LinkListUser p=headUser->User_next;
int num;
printf("输入封号玩家信用值底限:");
scanf("%d",&num);
while(p)
{
if(p->User_credit<=num)
{
strcmp(p->User_status,"封号玩家");
break;
}
p=p->User_next;
}
printf("封号成功\n");
}
int I_DeleteListHero(LinkListHero headHero)//获取删除英雄位置
{
LinkListHero p=headHero->next;
char nameA[22];
int count=0;
printf("输入要删除英雄姓名:");
scanf("%s",nameA);
while(p)
{
count++;
if(strcmp(nameA,p->name)==0)
{
break;
}
p=p->next;
}
if(count==0){
printf("要删除的英雄不存在!\n");
}
return count;
}int I_DeleteListWeapon(LinkListWeapon headWeapon)//获取删除装备位置
{
LinkListWeapon p=headWeapon->Weapon_next;
char Weapon_nameA[22];
int count=0;
printf("输入要删除装备名称:");
scanf("%s",Weapon_nameA);
while(p)
{
count++;
if(strcmp(Weapon_nameA,p->Weapon_name)==0)
{
break;
}
p=p->Weapon_next;
}
if(count==0){
printf("要删除的装备不存在!\n");
}
return count;
}int I_DeleteListUser(LinkListUser headUser)//获取删除账户位置
{
LinkListUser p=headUser->User_next;
char User_idA[15];
int count=0;
printf("输入要删除的账号:");
scanf("%s",User_idA);
while(p)
{
count++;
if(strcmp(User_idA,p->User_id)==0)
{
break;
}
p=p->User_next;
}
if(count==0)
printf("无此账号!\n");
return count;
}void DeleteListHero(LinkListHero headHero,int IDeleteHero)//删除英雄
{
LinkListHero pre=headHero,p;
int j=0;
while(pre&&jpre=pre->next;
j++;
}
p=pre->next;
pre->next=p->next;
free(p);
printf("删除已完成\n");
}void DeleteListWeapon(LinkListWeapon headWeapon,int IDeleteWeapon)//删除装备
{
LinkListWeapon pre=headWeapon,p;
int j=0;
while(pre&&jpre=pre->Weapon_next;
j++;
}
p=pre->Weapon_next;
pre->Weapon_next=p->Weapon_next;
free(p);
printf("删除已完成\n");
}void DeleteListUser(LinkListUser headUser,int IDeleteUser)//删除账号
{
LinkListUser pre=headUser,p;
int j=0;
while(pre&&j{
pre=pre->User_next;
j++;
}
p=pre->User_next;
pre->User_next=p->User_next;
free(p);
printf("账号删除成功\n");
}void InsertListHero(LinkListHero headHero)//插入英雄
{
LinkListHero pre=headHero,p,q=headHero;
p=(LinkListHero)malloc(sizeof(LNodeHero));
char nameA[22];
char sexA[10];
char typeA[10];
char professionA[10];
char placeA[22];
int moneyA;
printf("输入要添加英雄姓名:\n");
scanf("%s",nameA);
while(q)
{
if(strcmp(q->name,nameA)==0)
{
printf("此英雄已有!\n");
return;
}
q=q->next;
}
printf("输入要添加英雄性别:\n");
scanf("%s",sexA);
printf("输入要添加英雄类型:\n");
scanf("%s",typeA);
printf("输入要添加英雄职业:\n");
scanf("%s",professionA);
printf("输入要添加英雄地域:\n");
scanf("%s",placeA);
printf("输入要添加英雄价格:\n");
scanf("%d",&moneyA);
strcpy(p->name,nameA);
strcpy(p->sex,sexA);
strcpy(p->type,typeA);
strcpy(p->profession,professionA);
strcpy(p->place,placeA);
p->money=moneyA;
p->next=pre->next;
pre->next=p;
printf("添加完成。\n");
}void InsertListWeapon(LinkListWeapon headWeapon)//插入装备
{
LinkListWeapon pre=headWeapon,p,q=headWeapon;
p=(LinkListWeapon)malloc(sizeof(LNodeWeapon));
char Weapon_nameA[30];
int Weapon_AttackA;
int Weapon_HpA;
int Weapon_SpA;
int Weapon_MpA;
int Weapon_CDA;
int Weapon_MagicA;
int Weapon_AttackSpeedA;
int Weapon_SpeedA;
int Weapon_SuperAttackA;
printf("输入要添加装备名称:\n");
scanf("%s",Weapon_nameA);
while(q)
{
if(strcmp(q->Weapon_name,Weapon_nameA)==0)
{
printf("此装备已有!\n");
return;
}
q=q->Weapon_next;
}
printf("输入要添加装备攻击:\n");
scanf("%d",&Weapon_AttackA);
printf("输入要添加装备生命值:\n");
scanf("%d",&Weapon_HpA);
printf("输入要添加装备护甲:\n");
scanf("%d",&Weapon_SpA);
printf("输入要添加装备魔抗:\n");
scanf("%d",&Weapon_MpA);
printf("输入要添加装备CD:\n");
scanf("%d",&Weapon_CDA);
printf("输入要添加装备法强:\n");
scanf("%d",&Weapon_MagicA);
printf("输入要添加装备攻速:\n");
scanf("%d",&Weapon_AttackSpeedA);
printf("输入要添加装备移速:\n");
scanf("%d",&Weapon_SpeedA);
printf("输入要添加装备暴击:\n");
scanf("%d",&Weapon_SuperAttackA);
strcpy(p->Weapon_name,Weapon_nameA);
p->Weapon_Attack=Weapon_AttackA;
p->Weapon_HP=Weapon_HpA;
p->Weapon_Sp=Weapon_SpA;
p->Weapon_Mp=Weapon_MpA;
p->Weapon_CD=Weapon_CDA;
p->Weapon_Magic=Weapon_MagicA;
p->Weapon_AttackSpeed=Weapon_AttackSpeedA;
p->Weapon_Speed=Weapon_SpeedA;
p->Weapon_SuperAttack=Weapon_SuperAttackA;
p->Weapon_next=pre->Weapon_next;
pre->Weapon_next=p;
printf("添加完成。\n");
}void InsertListUser(LinkListUser headUser)//添加账户
{
LinkListUser pre=headUser,p,q=headUser;
p=(LinkListUser)malloc(sizeof(LNodeUser));
char User_nameA[22];
char User_idA[10];
char User_passwordA[5];
int User_moneyA;
int User_HeroNumA;
int User_creditA;
char User_statusA[25];
printf("输入新的账号:\n");
scanf("%s",User_idA);
while(q)
{
if(strcmp(q->User_id,User_idA)==0)
{
printf("此英雄已有!\n");
return;
}
q=q->User_next;
}
printf("输入昵称:");
scanf("%s",User_nameA);
printf("输入密码:");
scanf("%s",User_passwordA);
printf("输入资产:");
scanf("%d",&User_moneyA);
printf("输入英雄数量:");
scanf("%d",&User_HeroNumA);
printf("输入信用值:");
scanf("%d",&User_creditA);
printf("输入身份:");
scanf("%s",User_statusA);
strcpy(p->User_name,User_nameA);
strcpy(p->User_id,User_idA);
strcpy(p->User_password,User_passwordA);
p->User_money=User_moneyA;
p->User_HeroNum=User_HeroNumA;
p->User_credit=User_creditA;
strcpy(p->User_status,User_statusA);
p->User_next=pre->User_next;
pre->User_next=p;
printf("添加完成。\n");
}void BuyHero(LinkListHero headHero,LinkListUser headUser,char idA[])//购买英雄
{
LinkListHero pHero=headHero->next;
LinkListUser pUser=headUser->User_next;
char nameA[25];
int count=0;
int HeroMoneyA;
int UserMoneyA;
while(1)
{
printf("请输入要购买的英雄:");
scanf("%s",nameA);
pHero=headHero->next;
while(pHero)
{
if(strcmp(pHero->name,nameA)==0)
{
count++;
HeroMoneyA=pHero->money;
break;
}
pHero=pHero->next;
}
if(count==0)
printf("无此英雄,请重新输入!\n");
else
break;
}
int x;
while(pUser)
{
if(strcmp(pUser->User_id,idA)==0)
{
if(pUser->User_money>=HeroMoneyA)
{
pUser->User_money=pUser->User_money-HeroMoneyA;
pUser->User_HeroNum=pUser->User_HeroNum+1;
printf("购买成功,消费%d,剩余%d\n",HeroMoneyA,pUser->User_money);
}
else{
printf("资金不足!无法购买\n");
return;
}
}
pUser=pUser->User_next;
}
}void VIPHeroSeek_JQ(LinkListHero headHero)//VIP玩家精确查询英雄
{
LinkListHero p=headHero->next;
int count=0;
int countB=0;
int Order;
char nameB[22];
while(1)
{
count=0;
countB=0;
printf("1.开始查询\n");
printf("2.返回上一级\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
printf("请输入英雄姓名:");
scanf("%s",nameB);
p=headHero->next;
while(p)
{
if(strcmp(p->name,nameB)==0)
{
countB++;
printf("*****************\n");
printf("姓名:%s\n",p->name);
printf("性别:%s\n",p->sex);
printf("类型:%s\n",p->type);
printf("职业:%s\n",p->profession);
printf("地域:%s\n",p->place);
printf("价格:%d\n",p->money);
printf("*****************\n");
break;
}
p=p->next;
}
if(countB==0)
printf("无此英雄!\n");
break;
case 2:
count++;
break;
default:
printf("指令错误!\n");
break;
}
if(count>0)
return;
}
}void VIPWeaponSeek_JQ(LinkListWeapon headWeapon) VIP玩家精确查询装备
{
LinkListWeapon p=headWeapon->Weapon_next;
int count=0;
int countB=0;
int Order;
char nameB[22];
while(1)
{
count=0;
countB=0;
printf("1.开始查询\n");
printf("2.返回上一级\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
printf("请输入装备名称:");
scanf("%s",nameB);
p=headWeapon->Weapon_next;
while(p)
{
if(strcmp(p->Weapon_name,nameB)==0)
{
countB++;
printf("*****************\n");
printf("名 称:%s\n",p->Weapon_name);
printf("攻 击:%d\n",p->Weapon_Attack);
printf("生 命 值:%d\n",p->Weapon_HP);
printf("护 甲:%d\n",p->Weapon_Sp);
printf("魔 抗:%d\n",p->Weapon_Mp);
printf("CD 减 免:%d\n",p->Weapon_CD);
printf("法 强:%d\n",p->Weapon_Magic);
printf("攻 速:%d\n",p->Weapon_AttackSpeed);
printf("移 速:%d\n",p->Weapon_Speed);
printf("暴 击:%d\n",p->Weapon_SuperAttack);
printf("*****************\n");
break;
}
p=p->Weapon_next;
}
if(countB==0)
printf("无此装备!\n");
break;
case 2:
count++;
break;
default:
printf("指令错误!\n");
break;
}
if(count>0)
return;
}
}
void VIPHeroSeek_Same_Sex(LinkListHero headHero)//VIP玩家同类型查询英雄 按性别
{
LinkListHero p=headHero->next;
int count=0;
char sexA[5];
printf("输入性别:");
scanf("%s",sexA);
while(p)
{
if(strcmp(p->sex,sexA)==0)
{
count++;
printf("姓名:%s ",p->name);
printf("性别:%s ",p->sex);
printf("类型:%s ",p->type);
printf("职业:%s ",p->profession);
printf("地域:%-13s ",p->place);
printf("价格:%d\n",p->money);
}
p=p->next;
}
if(count==0)
printf("性别输入错误!\n");
}void VIPHeroSeek_Same_Type(LinkListHero headHero)//VIP玩家同类型查询英雄 按类型
{
LinkListHero p=headHero->next;
int count=0;
char typeA[10];
printf("输入类型:");
scanf("%s",typeA);
while(p)
{
if(strcmp(p->type,typeA)==0)
{
count++;
printf("姓名:%s ",p->name);
printf("性别:%s ",p->sex);
printf("类型:%s ",p->type);
printf("职业:%s ",p->profession);
printf("地域:%-13s ",p->place);
printf("价格:%d\n",p->money);
}
p=p->next;
}
if(count==0)
printf("类型输入错误!\n");
}void VIPHeroSeek_Same_Professsion(LinkListHero headHero)//VIP玩家同类型查询英雄 按职业
{
LinkListHero p=headHero->next;
int count=0;
char professionA[10];
printf("输入职业:");
scanf("%s",professionA);
while(p)
{
if(strcmp(p->profession,professionA)==0)
{
count++;
printf("姓名:%s ",p->name);
printf("性别:%s ",p->sex);
printf("类型:%s ",p->type);
printf("职业:%s ",p->profession);
printf("地域:%-13s ",p->place);
printf("价格:%d\n",p->money);
}
p=p->next;
}
if(count==0)
printf("职业输入错误!\n");
}void VIPHeroSeek_Same_Place(LinkListHero headHero)//VIP玩家同类型查询英雄 按地域
{
LinkListHero p=headHero->next;
int count=0;
char placeA[22];
printf("输入地域:");
scanf("%s",placeA);
while(p)
{
if(strcmp(p->place,placeA)==0)
{
count++;
printf("姓名:%s ",p->name);
printf("性别:%s ",p->sex);
printf("类型:%s ",p->type);
printf("职业:%s ",p->profession);
printf("地域:%-13s ",p->place);
printf("价格:%d\n",p->money);
}
p=p->next;
}
if(count==0)
printf("地域输入错误!\n");
}void VIPHeroSeek_Same_Money(LinkListHero headHero)//VIP玩家同类型查询英雄 按价格
{
LinkListHero p=headHero->next;
int count=0;
int moneyA;
printf("输入价格:");
scanf("%d",&moneyA);
while(p)
{
if(p->money==moneyA)
{
count++;
printf("姓名:%s ",p->name);
printf("性别:%s ",p->sex);
printf("类型:%s ",p->type);
printf("职业:%s ",p->profession);
printf("地域:%-13s ",p->place);
printf("价格:%d\n",p->money);
}
p=p->next;
}
if(count==0)
printf("价格输入错误!\n");
}void VIPHeroSeek_Same(LinkListHero headHero)//VIP玩家同类型查询 英雄
{
LinkListHero p=headHero->next;int count=0;
int Order;
int count_sex=0;
int count_type=0;
int count_professsion=0;
int count_place=0;
int count_money=0;
while(1)
{
printf("**************\n");
printf("1.按性别查询\n");
printf("2.按类型查询\n");
printf("3.按职业查询\n");
printf("4.按地域查询\n");
printf("5.按价格查询\n");
printf("6.返回上一级\n");
printf("**************\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
while(1)
{
count_sex=0;
printf("1.开始查询\n");
printf("2.返回上一级\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
VIPHeroSeek_Same_Sex(headHero);
break;
case 2:
count_sex++;
break;
default :
printf("指令错误!\n");
break;
}
if(count_sex>0)
break;
}
break;
case 2:
while(1)
{
count_type=0;
printf("1.开始查询\n");
printf("2.返回上一级\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
VIPHeroSeek_Same_Type(headHero);
break;
case 2:
count_type++;
break;
default :
printf("指令错误!\n");
break;
}
if(count_type>0)
break;
}
break;
case 3:
while(1)
{
count_professsion=0;
printf("1.开始查询\n");
printf("2.返回上一级\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
VIPHeroSeek_Same_Professsion(headHero);
break;
case 2:
count_professsion++;
break;
default :
printf("指令错误!\n");
break;
}
if(count_professsion>0)
break;
}
break;
case 4:
while(1)
{
count_place=0;
printf("1.开始查询\n");
printf("2.返回上一级\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
VIPHeroSeek_Same_Place(headHero);
break;
case 2:
count_place++;
break;
default :
printf("指令错误!\n");
break;
}
if(count_place>0)
break;
}
break;
case 5:
while(1)
{
count_money=0;
printf("1.开始查询\n");
printf("2.返回上一级\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
VIPHeroSeek_Same_Money(headHero);
break;
case 2:
count_money++;
break;
default :
printf("指令错误!\n");
break;
}
if(count_money>0)
break;
}
break;
case 6:
count++;
break;
default :
printf("指令错误!\n");
break;
}
if(count>0)
return;
}
}void VIPWeaponSeek_Same(LinkListWeapon headWeapon)//VIP玩家同类型查询 装备
{
LinkListWeapon p=headWeapon->Weapon_next;
int count=0;
int Order;
while(1)
{
count=0;
printf("1.攻击加成\n");
printf("2.生命值加成\n");
printf("3.护甲加成\n");
printf("4.魔抗加成\n");
printf("5.CD加成\n");
printf("6.法强加成\n");
printf("7.攻速加成\n");
printf("8.移速加成\n");
printf("9.暴击加成\n");
printf("10.返回上一级\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
p=headWeapon->Weapon_next;
while(p)
{
if(p->Weapon_Attack>0)
{
printf("名称:%-16s",p->Weapon_name);
printf("攻击:%-4d ",p->Weapon_Attack);
printf("生命值:%d ",p->Weapon_HP);
printf("护甲:%d ",p->Weapon_Sp);
printf("魔抗:%d ",p->Weapon_Mp);
printf("CD减免:%d ",p->Weapon_CD);
printf("法强:%d ",p->Weapon_Magic);
printf("攻速:%d ",p->Weapon_AttackSpeed);
printf("移速:%d ",p->Weapon_Speed);
printf("暴击:%d\n",p->Weapon_SuperAttack);
}
p=p->Weapon_next;
}
break;
case 2:
p=headWeapon->Weapon_next;
while(p)
{
if(p->Weapon_HP>0)
{
printf("名称:%-16s",p->Weapon_name);
printf("攻击:%-4d ",p->Weapon_Attack);
printf("生命值:%d ",p->Weapon_HP);
printf("护甲:%d ",p->Weapon_Sp);
printf("魔抗:%d ",p->Weapon_Mp);
printf("CD减免:%d ",p->Weapon_CD);
printf("法强:%d ",p->Weapon_Magic);
printf("攻速:%d ",p->Weapon_AttackSpeed);
printf("移速:%d ",p->Weapon_Speed);
printf("暴击:%d\n",p->Weapon_SuperAttack);
}
p=p->Weapon_next;
}
break;
case 3:
p=headWeapon->Weapon_next;
while(p)
{
if(p->Weapon_Sp>0)
{
printf("名称:%-16s",p->Weapon_name);
printf("攻击:%-4d ",p->Weapon_Attack);
printf("生命值:%d ",p->Weapon_HP);
printf("护甲:%d ",p->Weapon_Sp);
printf("魔抗:%d ",p->Weapon_Mp);
printf("CD减免:%d ",p->Weapon_CD);
printf("法强:%d ",p->Weapon_Magic);
printf("攻速:%d ",p->Weapon_AttackSpeed);
printf("移速:%d ",p->Weapon_Speed);
printf("暴击:%d\n",p->Weapon_SuperAttack);
}
p=p->Weapon_next;
}
break;
case 4:
p=headWeapon->Weapon_next;
while(p)
{
if(p->Weapon_Mp>0)
{
printf("名称:%-16s",p->Weapon_name);
printf("攻击:%-4d ",p->Weapon_Attack);
printf("生命值:%d ",p->Weapon_HP);
printf("护甲:%d ",p->Weapon_Sp);
printf("魔抗:%d ",p->Weapon_Mp);
printf("CD减免:%d ",p->Weapon_CD);
printf("法强:%d ",p->Weapon_Magic);
printf("攻速:%d ",p->Weapon_AttackSpeed);
printf("移速:%d ",p->Weapon_Speed);
printf("暴击:%d\n",p->Weapon_SuperAttack);
}
p=p->Weapon_next;
}
break;
case 5:
p=headWeapon->Weapon_next;
while(p)
{
if(p->Weapon_CD>0)
{
printf("名称:%-16s",p->Weapon_name);
printf("攻击:%-4d ",p->Weapon_Attack);
printf("生命值:%d ",p->Weapon_HP);
printf("护甲:%d ",p->Weapon_Sp);
printf("魔抗:%d ",p->Weapon_Mp);
printf("CD减免:%d ",p->Weapon_CD);
printf("法强:%d ",p->Weapon_Magic);
printf("攻速:%d ",p->Weapon_AttackSpeed);
printf("移速:%d ",p->Weapon_Speed);
printf("暴击:%d\n",p->Weapon_SuperAttack);
}
p=p->Weapon_next;
}
break;
case 6:
p=headWeapon->Weapon_next;
while(p)
{
if(p->Weapon_Magic>0)
{
printf("名称:%-16s",p->Weapon_name);
printf("攻击:%-4d ",p->Weapon_Attack);
printf("生命值:%d ",p->Weapon_HP);
printf("护甲:%d ",p->Weapon_Sp);
printf("魔抗:%d ",p->Weapon_Mp);
printf("CD减免:%d ",p->Weapon_CD);
printf("法强:%d ",p->Weapon_Magic);
printf("攻速:%d ",p->Weapon_AttackSpeed);
printf("移速:%d ",p->Weapon_Speed);
printf("暴击:%d\n",p->Weapon_SuperAttack);
}
p=p->Weapon_next;
}
break;
case 7:
p=headWeapon->Weapon_next;
while(p)
{
if(p->Weapon_AttackSpeed>0)
{
printf("名称:%-16s",p->Weapon_name);
printf("攻击:%-4d ",p->Weapon_Attack);
printf("生命值:%d ",p->Weapon_HP);
printf("护甲:%d ",p->Weapon_Sp);
printf("魔抗:%d ",p->Weapon_Mp);
printf("CD减免:%d ",p->Weapon_CD);
printf("法强:%d ",p->Weapon_Magic);
printf("攻速:%d ",p->Weapon_AttackSpeed);
printf("移速:%d ",p->Weapon_Speed);
printf("暴击:%d\n",p->Weapon_SuperAttack);
}
p=p->Weapon_next;
}
break;
case 8:
p=headWeapon->Weapon_next;
while(p)
{
if(p->Weapon_Speed>0)
{
printf("名称:%-16s",p->Weapon_name);
printf("攻击:%-4d ",p->Weapon_Attack);
printf("生命值:%d ",p->Weapon_HP);
printf("护甲:%d ",p->Weapon_Sp);
printf("魔抗:%d ",p->Weapon_Mp);
printf("CD减免:%d ",p->Weapon_CD);
printf("法强:%d ",p->Weapon_Magic);
printf("攻速:%d ",p->Weapon_AttackSpeed);
printf("移速:%d ",p->Weapon_Speed);
printf("暴击:%d\n",p->Weapon_SuperAttack);
}
p=p->Weapon_next;
}
break;
case 9:
p=headWeapon->Weapon_next;
while(p)
{
if(p->Weapon_SuperAttack>0)
{
printf("名称:%-16s",p->Weapon_name);
printf("攻击:%-4d ",p->Weapon_Attack);
printf("生命值:%d ",p->Weapon_HP);
printf("护甲:%d ",p->Weapon_Sp);
printf("魔抗:%d ",p->Weapon_Mp);
printf("CD减免:%d ",p->Weapon_CD);
printf("法强:%d ",p->Weapon_Magic);
printf("攻速:%d ",p->Weapon_AttackSpeed);
printf("移速:%d ",p->Weapon_Speed);
printf("暴击:%d\n",p->Weapon_SuperAttack);
}
p=p->Weapon_next;
}
break;
case 10:
count++;
break;
default :
printf("指令错误!\n");
break;
}
if(count>0)
return;
}
}void VIPHeroSeek_NumS(LinkListHero headHero)//VIP多条件查询英雄
{
LinkListHero p=headHero->next;
int count=0;
int Order;
char sexA[10];
char typeA[10];
char professionA[10];
char placeA[10];
int moneyA;
int count_sexA=0;
int count_typeA=0;
int count_professionA=0;
int count_placeA=0;
int count_moneyA=0;
while(1)
{
count=0;
printf("1.开始查询\n");
printf("2.返回上一级\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
p=headHero->next;
count_sexA=0;
count_typeA=0;
count_professionA=0;
count_placeA=0;
count_moneyA=0;
printf("输入性别,不限制输入均可,回车键结束输入:");
scanf("%s",sexA);
printf("输入类型,不限制输入均可,回车键结束输入:");
scanf("%s",typeA);
printf("输入职业,不限制输入均可,回车键结束输入:");
scanf("%s",professionA);
printf("输入地域,不限制输入均可,回车键结束输入:");
scanf("%s",placeA);
printf("输入价格,不限制输入0,回车键结束输入:");
scanf("%d",&moneyA);
while(p)
{
if(strcmp(p->sex,sexA)==0||strcmp(sexA,"均可")==0)
{
count_sexA++;
if(strcmp(p->type,typeA)==0||strcmp(typeA,"均可")==0)
{
count_typeA++;
if(strcmp(p->profession,professionA)==0||strcmp(professionA,"均可")==0)
{
count_professionA++;
if(strcmp(p->place,placeA)==0||strcmp(placeA,"均可")==0)
{
count_placeA++;
if(p->money==moneyA||moneyA==0)
{
count_moneyA++;
printf("姓名:%s ",p->name);
printf("性别:%s ",p->sex);
printf("类型:%s ",p->type);
printf("职业:%s ",p->profession);
printf("地域:%-13s ",p->place);
printf("价格:%d\n",p->money);
}
}
}
}
}
p=p->next;
}
if(count_sexA==0||count_typeA==0||count_professionA==0||count_placeA==0||count_moneyA==0)
printf("输入错误!\n");
break;
case 2:
count++;
break;
default :
printf("指令错误!\n");
}
if(count>0)
break;
}
}void VIPWeaponSeek_NumS(LinkListWeapon headWeapon)//VIP多条件查询装备
{
LinkListWeapon p=headWeapon->Weapon_next;
int Weapon_AttackA;
int Weapon_HpA;
int Weapon_SpA;
int Weapon_MpA;
int Weapon_CDA;
int Weapon_MagicA;
int Weapon_AttackSpeedA;
int Weapon_SpeedA;
int Weapon_SuperAttackA;
int Order=0;
int count=0;
while(1)
{
count=0;
printf("1.开始查询\n");
printf("2.返回上一级\n");
printf("输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
printf("攻击力,限制输入1,不限制输入0:");
scanf("%d",&Weapon_AttackA);
printf("生命值,限制输入1,不限制输入0:");
scanf("%d",&Weapon_HpA);
printf("护甲,限制输入1,不限制输入0:");
scanf("%d",&Weapon_SpA);
printf("魔抗,限制输入1,不限制输入0:");
scanf("%d",&Weapon_MpA);
printf("CD,限制输入1,不限制输入0:");
scanf("%d",&Weapon_CDA);
printf("法强,限制输入1,不限制输入0:");
scanf("%d",&Weapon_MagicA);
printf("攻速,限制输入1,不限制输入0:");
scanf("%d",&Weapon_AttackSpeedA);
printf("移速,限制输入1,不限制输入0:");
scanf("%d",&Weapon_SpeedA);
printf("暴击,限制输入1,不限制输入0:");
scanf("%d",&Weapon_SuperAttackA);
p=headWeapon->Weapon_next;
while(p)
{
if(p->Weapon_Attack>0||Weapon_AttackA==0)
{
if(p->Weapon_HP>0||Weapon_HpA==0)
{
if(p->Weapon_Sp>0||Weapon_SpA==0)
{
if(p->Weapon_Mp>0||Weapon_MpA==0)
{
if(p->Weapon_CD>0||Weapon_CDA==0)
{
if(p->Weapon_Magic>0||Weapon_MagicA==0)
{
if(p->Weapon_AttackSpeed>0||Weapon_AttackSpeedA==0)
{
if(p->Weapon_Speed>0||Weapon_SpeedA==0)
{
if(p->Weapon_SuperAttack>0||Weapon_SuperAttackA==0)
{
printf("名称:%s ",p->Weapon_name);
printf("攻击:%d ",p->Weapon_Attack);
printf("生命值:%d ",p->Weapon_HP);
printf("护甲:%d ",p->Weapon_Sp);
printf("魔抗:%d ",p->Weapon_Mp);
printf("CD减免:%d ",p->Weapon_CD);
printf("法强:%d ",p->Weapon_Magic);
printf("攻速:%d ",p->Weapon_AttackSpeed);
printf("移速:%d ",p->Weapon_Speed);
printf("暴击:%d\n",p->Weapon_SuperAttack);
}
}
}
}
}
}
}
}
}
p=p->Weapon_next;
}
break;
case 2:
count++;
break;
default :
printf("指令错误!\n");
break;
}
if(count>0)
return;
}
}void VIPHeroSeek(LinkListHero headHero) //VIP玩家英雄查询
{
LinkListHero p=headHero->next;
int count=0;
int Order;
while(1)
{
count=0;
printf("**************\n");
printf("1.查阅所有英雄\n");
printf("2.精确查询\n");
printf("3.同类查询\n");
printf("4.多条件查询\n");
printf("5.返回上一级\n");
printf("**************\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
PrintListHero(headHero);
break;
case 2:
VIPHeroSeek_JQ(headHero);
break;
case 3:
VIPHeroSeek_Same(headHero);
break;
case 4:
VIPHeroSeek_NumS(headHero);
break;
case 5:
count++;
break;
default :
printf("指令错误!\n");
break;
}
if(count>0)
return;
}
}void VIPWeaponSeek(LinkListWeapon headWeapon) //VIP玩家装备查询
{
LinkListWeapon p=headWeapon->Weapon_next;
int count=0;
int Order;
while(1)
{
count=0;
printf("**************\n");
printf("1.查阅所有装备\n");
printf("2.精确查询\n");
printf("3.同类查询\n");
printf("4.多条件查询\n");
printf("5.返回上一级\n");
printf("**************\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
PrintListWeapon(headWeapon);
break;
case 2:
VIPWeaponSeek_JQ(headWeapon);
break;
case 3:
VIPWeaponSeek_Same(headWeapon);
break;
case 4:
VIPWeaponSeek_NumS(headWeapon);
break;
case 5:
count++;
break;
default :
printf("指令错误!\n");
break;
}
if(count>0)
return;
}
}int main(int argc, char *argv[]) {
// 创建英雄信息链表
LinkListHero headHero;
headHero=(LinkListHero)malloc(sizeof(LNodeHero));
headHero->next=NULL;
CreateListHero(headHero);
freopen("CON.txt","r",stdin);
//创建装备信息链表
LinkListWeapon headWeapon;
headWeapon=(LinkListWeapon)malloc(sizeof(LNodeWeapon));
headWeapon->Weapon_next=NULL;
CreateListWeapon(headWeapon);
freopen("CON.txt","r",stdin);
//创建用户信息链表
LinkListUser headUser;
headUser=(LinkListUser)malloc(sizeof(LNodeUser));
headUser->User_next=NULL;
CreateListUser(headUser);
freopen("CON.txt","r",stdin);
//指令
int Order;
//退出登录/返回上一级计数器
int UserSSS;
int UserS;
int UserS_Hero;
int UserS_Weapon;
int User;
int UserVIP;
//删除位置
int IDeleteUser;
int IDeleteHero;
int IDeleteWeapon;
while(1)
{
Order=0;
printf("************************\n");
printf("欢迎进入英雄联盟查询系统\n");
printf("************************\n");
printf("请输入账号:");
char InputId[22];
scanf("%s",InputId);
printf("请输入密码:");
char InputPassword[10];
scanf("%s",InputPassword);
printf("\n");
Order=UserLogin(headUser,InputId,InputPassword);
switch(Order)
{
case 1:
UserSSS==0;
while(1)
{
printf("系统管理员\n");
Personal(headUser,InputId);
printf("******************\n");
printf("1.修改个人信息\n");
printf("2.调阅用户信息\n");
printf("3.设置VIP玩家\n");
printf("4.封号\n");
printf("5.删除账户\n");
printf("6.创建新账户\n");
printf("7.退出登录\n");
printf("******************\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
AmendListUser(headUser,InputId);
break;
case 2:
PrintListUser(headUser);
break;
case 3:
VIP(headUser);
break;
case 4:
Freeze(headUser);
break;
case 5:
IDeleteUser=I_DeleteListUser(headUser);
if(IDeleteUser)
DeleteListUser(headUser,IDeleteUser);
break;
case 6:
InsertListUser(headUser);
break;
case 7:
UserSSS++;
break;
default:
printf("指令错误!\n");
break;
}
if(UserSSS>0)
break;
}
break;
case 2:
UserS=0;
while(1)
{
printf("普通管理员\n");
Personal(headUser,InputId);
printf("******************\n");
printf("1.修改个人信息\n");
printf("2.英雄信息管理\n");
printf("3.装备信息管理\n");
printf("4.退出登录\n");
printf("******************\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
AmendListUser(headUser,InputId);
break;
case 2:
UserS_Hero=0;
while(1)
{
printf("******************\n");
printf("1.调阅英雄信息\n");
printf("2.修改英雄信息\n");
printf("3.删除英雄信息\n");
printf("4.添加英雄信息\n");
printf("5.返回上一级\n");
printf("******************\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
PrintListHero(headHero);
break;
case 2:
AmendListHero(headHero);
break;
case 3:
IDeleteHero=I_DeleteListHero(headHero);
if(IDeleteHero)
DeleteListHero(headHero,IDeleteHero);
break;
case 4:
InsertListHero(headHero);
break;
case 5:
UserS_Hero++;
break;
default :
printf("指令错误!\n");
break;
}
if(UserS_Hero>0)
break;
}
break;
case 3:
UserS_Weapon=0;
while(1)
{
printf("******************\n");
printf("1.调阅装备信息\n");
printf("2.修改装备信息\n");
printf("3.删除装备信息\n");
printf("4.添加装备信息\n");
printf("5.返回上一级\n");
printf("******************\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
PrintListWeapon(headWeapon);
break;
case 2:
AmendListWeapon(headWeapon);
break;
case 3:
IDeleteWeapon=I_DeleteListWeapon(headWeapon);
if(IDeleteWeapon)
DeleteListWeapon(headWeapon,IDeleteWeapon);
break;
case 4:
InsertListWeapon(headWeapon);
break;
case 5:
UserS_Weapon++;
break;
default :
printf("指令错误!\n");
break;
}
if(UserS_Weapon>0)
break;
}
break;
case 4:
UserS++;
break;
default :
printf("指令错误!\n");
break;
}
if(UserS>0)
break;
}
break;
case 3:
User=0;
while(1)
{
printf("玩家\n");
Personal(headUser,InputId);
printf("******************\n");
printf("1.修改个人信息:\n");
printf("2.查询英雄信息:\n");
printf("3.查询装备信息:\n");
printf("4.购买英雄:\n");
printf("5.退出登录:\n");
printf("******************\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
AmendListUser(headUser,InputId);
break;
case 2:
PrintListHero(headHero);
break;
case 3:
PrintListWeapon(headWeapon);
break;
case 4:
BuyHero(headHero,headUser,InputId);
break;
case 5:
User++;
break;
case 6:
break;
}
if(User>0)
break;
}
break;
case 4:
UserVIP=0;
while(1)
{
printf("VIP玩家\n");
Personal(headUser,InputId);
printf("******************\n");
printf("1.修改个人信息:\n");
printf("2.查询英雄信息:\n");
printf("3.查询装备信息:\n");
printf("4.购买英雄:\n");
printf("5.退出登录:\n");
printf("******************\n");
printf("请输入数字选项:");
scanf("%d",&Order);
switch(Order)
{
case 1:
AmendListUser(headUser,InputId);
break;
case 2:
VIPHeroSeek(headHero);
break;
case 3:
VIPWeaponSeek(headWeapon);
break;
case 4:
BuyHero(headHero,headUser,InputId);
break;
case 5:
UserVIP++;
break;
case 6:
break;
}
if(UserVIP>0)
break;
}
break;
case 5:
printf("由于信用值过低,此号被封!\n");
break;
case 6:
printf("账号错误!\n");
break;
case 7:
printf("密码错误!\n");
}
}
return 0;
}