C/C++模仿小灵通系统

// 小灵通设置
#include<iostream.h>
#include<string.h>
#include<stdlib.h>
#include<iomanip.h>
extern char mi[50]="/0";
extern char huida[50]="罗振辉";
extern char wenti[50]="您的姓名是什么?";
extern int ww=0;
extern int kkk=0;
extern int ggg=0;
extern int BBB=0;
const int B=500;
const int N=14;
const int M=12;
struct num
{
char name[N];
char hm[M];
struct num *next;
};
void duanxinxi();
void tonhuajilu();
void dianhuabo();
num *creat(num *head);//链表的建立
void print(num *head);//链表的遍历
num *insert(num *head);//添加数据
num *del(num *head);//删除数据
num *change(num *head);//数据修改
int ppp(num *head);//zhidaon的值
void xingm(num *nu,num *head);//以xingming大小排序
void ncreat(num *head,num *nu);//把链表转化为结构体
num *nncreat(num *nu,num *head);//结构体转化为链表
void zhilibipin();
void pinguoji(char nac[][14],int k,int b[]);//苹果机
void start(int &f);//开始游戏//注意利用引用的方法
void registed(char nac[][14],int k);
void mmpaihang(char nac[][14],int b[],int k);//排行榜
void bccd();
void chazao(num *head);//查早
void gerenshezhi();
void youxi();
void lingsheng();
void shezhi();
void lingtongwusheng();
void zengzhifuwu();
void dadianhua();
void main()
{int ch;
char mh[50];
char h='n';
cout<<"****************************/n";
cout<<"欢迎使用灵通设置!"<<endl;
cout<<"作者:罗振辉"<<endl;
cout<<"...........................*/n";
cout<<endl;
ww=5;
strcpy(mi,"luozhen");
while(ww<=5&&ww>0)
{ww--;
cout<<"请输入密码:";
cin>>mh;
if(strcmp(mi,mh)==0)
{
while(h!='Y'&&h!='y')
{cout<<"******************************/n";
cout<<"*短信息 1*/n";
cout<<"*通话记录 2*/n";
cout<<"*电话薄 3*/n";
cout<<"*个人设置 4*/n";
cout<<"*游戏 5*/n";
cout<<"*铃声 6*/n";
cout<<"*设置 7*/n";
cout<<"*灵通无绳 8*/n";
cout<<"*增值服务 9*/n";
cout<<"*退出系统 10*/n";
cout<<"*打电话 11*/n";
cout<<"******************************/n";
cout<<"请选择需要的服务类型:";
cin>>ch;
switch(ch)
{
case 1:
{cout<<endl;
duanxinxi();break;
}
case 2: {cout<<endl;
tonhuajilu();break;
}
case 3: {cout<<endl;
dianhuabo();break;
}
case 4: {cout<<endl;
gerenshezhi();break;
}
case 5: {cout<<endl;
youxi();break;
}
case 6: {cout<<endl;
lingsheng();break;
}
case 7: {cout<<endl;
shezhi();break;
}
case 8: {cout<<endl;
lingtongwusheng();break;
}
case 9: {cout<<endl;
zengzhifuwu();break;
}
case 10: {cout<<endl;
cout<<"是否确定要退出此系统请输入Y或y: ";
cin>>h;
cout<<"退出系统成功!"<<endl;
break;
}
case 11: {cout<<endl;
dadianhua();break;
}
default: {cout<<endl;
cout<<"选择错误! 如果要重新选择请输入数字任意键:";
cin>>ch;
break;
}
}
}
}
else
cout<<"您的密码输入错误! 您还有"<<ww<<"次机会!"<<endl;
}
}
void dianhuabo()
{int ch;
char h='n';
kkk=0;
num *head,*nu;
nu=new num[B];
head=NULL;
while(h!='Y'&&h!='y')
{
cout<<"*********电话薄**********/n";
cout<<"*建立电话薄 *0/n";
cout<<"*查找 *1/n";
cout<<"*删除 *2/n";
cout<<"*新增 *3/n";
cout<<"*修改 *4/n";//插入到最开头
cout<<"*查看电话薄 *5/n";
cout<<"*退出系统 *6/n";
cout<<"*************************/n";
cout<<"请选择需要的服务类型:";
cin>>ch;
switch(ch)
{
case 0: if(kkk==0)
{head=creat(head);kkk++;
}
else
{cout<<"您已经建立了电话薄!请不要建立!"<<endl;}break;
case 1: {cout<<endl;chazao(head);break;
}
case 2: {cout<<endl;
head=del(head);
break;}
case 3: {cout<<endl;
head=insert(head);
kkk++;
break;}
case 4: {cout<<endl;
head=change(head);break;
}
case 5: {cout<<endl;
ncreat(head,nu);
xingm(nu,head);
head=nncreat(nu,head);//结构体转化为链表
print(head);break;
}//增加排序
case 6: {cout<<endl;
cout<<"确定要退出此系统请输入y或Y: ";
cin>>h;
cout<<"退出程序成功!"<<endl;
break;
}
default: {cout<<endl;
cout<<"选择错误! 如果要重新选择请输入数字任意键:";
cin>>ch;
break;
}
}
}
}
num *creat(num *head)
{ num *p,*p1;
char nam[N],h[M];
int n=0;
head=NULL;p=new num;
cout<<"请输入姓名(以*结束):";
cin>>nam;//缺点 必须要从姓名开始?
while(strcmp(nam,"*")!=0)
{n++;
strcpy(p->name,nam);
cout<<"请输入电话号码:";//假如有两个或多个电话号码怎么办?
cin>>h;
strcpy(p->hm,h);
if(n==1) head=p;
p1=p;
p=new num;
p1->next=p;
cout<<"请输入另一个姓名(以*结束):";
cin>>nam;
}
p1->next=NULL;
return head;
}
num *del(num *head)//删除数据
{char nam[N];
num *p,*p1;
p=head;
cout<<"请输入要删除的姓名(以*结束):";
cin>>nam;
while(strcmp(nam,"*")!=0)
{p=head;
if(head==NULL)
cout<<"电话薄没有数据!"<<endl;
else if(strcmp(head->name,nam)==0)
head=head->next;
else
{while(strcmp(p->name,nam)!=0&&p->next!=NULL)
{p1=p;p=p->next;}
if(strcmp(p->name,nam)==0)
{if(p->next==NULL)
p1->next=NULL;
else
p1->next=p->next;
}
else
cout<<" No find!"<<endl;
}
cout<<"请输入要删除的姓名(以*结束):";
cin>>nam;
}
return head;
}
num *change(num *head)//数据修改
{char nam[N],h[M];
num *p,*p1;
p=head;
cout<<"请输入要修改的姓名(以*结束):";
cin>>nam;
while(strcmp(nam,"*")!=0)
{
if(head==NULL)
cout<<"电话薄没有数据!"<<endl;
else if(strcmp(head->name,nam)==0)
{cout<<"请输入新的号码:";
cin>>h;
strcpy(head->name,nam);
strcpy(p->hm,h);
cout<<"请输入要修改的姓名(以*结束):";
cin>>nam;
}
else
{ cout<<"请输入新的号码:";
cin>>h;
while(strcmp(p->name,nam)!=0&&p->next!=NULL)
{p1=p;p=p->next;
}
if(strcmp(p->name,nam)==0)
{strcpy(head->name,nam);
strcpy(p->hm,h);
cout<<"请输入要修改的姓名(以*结束):";
cin>>nam;
}
else
{cout<<" No find!"<<endl;
cout<<"请重新输入要修改的姓名(以*结束):";
cin>>nam;
}
}
}
return head;
}
/*num *insert(num *head)//添加数据//是否和有序排列有关
{num *p,*p1;
int i=0;
p=new num;
cout<<"请输入要添加的号码(以#结束):";
cin>>p->hm;
while(strcmp(p->hm,"#")!=0)
{i++;
cout<<"请输入要添加人的姓名:";
cin>>p->name;
p1=p;
if(i==1) p->next=head;
p=new num;
p->next=p1;
cout<<"请输入再次要添加的号码(以#结束):";
cin>>p->hm;
}
return p;
}*/
num *insert(num *head)//添加数据
{num *p,*p1,*p2,*p3;
p1=head;
p=new num;
cout<<"请输入要添加的号码(以#结束):";
cin>>p->hm;
while(strcmp(p->hm,"#")!=0)
{ cout<<"请输入要添加人的姓名:";
cin>>p->name;
if(head==NULL)
{head=p;p->next=NULL;}
else if(strcmp(p->name,head->name)<0)
{p->next=head;head=p;
}
else
{while(strcmp(p->name,p1->name)>0&&p1->next!=NULL)
{p2=p1;p1=p1->next;}
if(p1==NULL)
{ p2->next=p;p->next=NULL;
}
else
{p2->next=p;p->next=p1;
}
}
p3=p;
p=new num;
p->next=p3;
cout<<endl;
cout<<"请输入要添加的号码(以#结束):";
cin>>p->hm;
}
return head;
}
int ppp(num *head)//zhidaon的值
{num *p;
int i=0;
p=head;
while(p!=NULL)
{i++;
p=p->next;}
return i;
}
void ncreat(num *head,num *nu)//把链表转化为结构体
{
int i=0;num *p;
p=head;
while(p!=NULL)
{strcpy(nu[i].name,p->name);
strcpy(nu[i].hm,p->hm);
p=p->next;
i++;
}
}
num *nncreat(num *nu,num *head)//结构体转化为链表
{int i=0;num *p;
p=head;
while(i<ppp(head)&&p!=NULL)
{strcpy(p->name,nu[i].name);
strcpy(p->hm,nu[i].hm);
p=p->next;
i++;
}
return head;
}
void xingm(num *nu,num *head)//以xingming大小排序
{int i,j;
char nam[N],h[M];
for(i=0;i<(ppp(head)-1);i++)
for(j=i+1;j<ppp(head);j++)
if(strcmp(nu[i].name,nu[j].name)>0)
{strcpy(h,nu[i].hm);
strcpy(nu[i].hm,nu[j].hm);
strcpy(nu[j].hm,h);
strcpy(nam,nu[i].name);
strcpy(nu[i].name,nu[j].name);
strcpy(nu[j].name,nam);
}
}
void print(num *head)//链表的遍历
{
num *p;
p=head;
if(head==NULL)
cout<<" no find !"<<endl;
else
while(p!=NULL)
{cout<<"姓名:"<<setw(14)<<p->name<<" 电话号码:"<<setw(14)<<p->hm<<endl;
p=p->next;
}
}
void chazao(num *head)
{char nam[N],ch='Y';
num *p;
p=head;
while(ch=='Y'||ch=='y')
{cout<<"请输入要要查找人的姓名(以*结束):";
cin>>nam;
if(head==NULL)
cout<<" no find!"<<endl;
else
while(strcmp(nam,"#")!=0&&p!=NULL)
{if(strcmp(p->name,nam)==0)
{cout<<"姓名:"<<setw(14)<<p->name<<" 电话号码:"<<setw(14)<<p->hm<<endl;
break;}
else
{p=p->next;
if(p==NULL)
cout<<"no find !"<<endl;
}
}
cout<<"如果要再次查找请输入Y或y 否则请输入其他任意键:";
cin>>ch;
}
}
void duanxinxi()
{cout<<"未实现!·"<<endl;}
void tonhuajilu()
{cout<<"未实现!·"<<endl;}
void gerenshezhi()
{cout<<"未实现!·"<<endl;}
void youxi()
{int ch,b[20],k=0;
char nac[20][14];
char h='n';
while(h!='Y'&&h!='y')
{cout<<"********游戏********/n";
cout<<"*智力比拼 1*/n";
cout<<"*苹果机 2*/n";
cout<<"*退出系统 3*/n";
cout<<"*********************/n";
cout<<"请选择游戏类型:";
cin>>ch;
switch(ch)
{case 1:zhilibipin();break;
case 2: pinguoji(nac,k,b);break;
case 3:{cout<<endl;
cout<<"确定要退出此系统请输入Y或y: ";
cin>>h;
cout<<"退出系统成功!"<<endl;break;
}
default :{cout<<endl;
cout<<"选择错误! 如果要重新选择请输入数字任意键:";
cin>>ch;break;
}
}
}
}
void pinguoji(char nac[][14],int k,int b[])
{int chh,f;
char K='n';
strcpy(nac[k],"成员");
while(K!='Y'&&K!='y')
{
cout<<"********苹果机**************/n";
cout<<"*开始游戏 1*/n";
cout<<"*记录 2*/n";
cout<<"*赢利排榜 3*/n";
cout<<"*退出游戏 4*/n";
cout<<"*游戏说明 5*/n";
cout<<"****************************/n";
cout<<"请选择服务类型:";
cin>>chh;
switch(chh)
{
case 1:
{f=500;
start(f);
b[k]=f;
}break;
case 2: {registed(nac,k);
f=500;
BBB++;
k++;
strcpy(nac[k],"成员");
}break;
case 3:mmpaihang(nac,b,k);break;
case 4:{cout<<endl;
cout<<"确定要退出请输入Y或y: ";
cin>>K;break;
}
case 5:bccd();break;
default:{ cout<<"请记录您的赢利情况!"<<endl;
registed(nac,k);
f=500;k++;
BBB++;
strcpy(nac[k],"成员");
}break;
}
}
}
void registed(char nac[][14],int k)
{char na[14];
cout<<"请输入姓名:";
cin>>na;
strcpy(nac[k],na);
}
void start(int &f)
{int ch,p,m,c,s,q,g,a,w=0;
int i=0,j=0,x1,n,r,sum=0;
int y1=0,y2=0,y3=0,y4=0;
int y5=0,y6=0,y7=0,y8=0,y9;
int P,C,A,S,G,Q,J,x2=0,x3;
char h='n',R='b';
while(R!='S'&&R!='s')
{
p=0;m=0;c=0;
s=0;q=0;g=0;a=0;
while(h!='Y'&&h!='y')
{
if(f>0)
{
cout<<"******请进行压分**********/n";
cout<<"*苹果×5 1*/n";
cout<<"*橘子×10 2*/n";
cout<<"*芒果×10 3*/n";
cout<<"*双星×20 4*/n";
cout<<"*西瓜×20 5*/n";
cout<<"* 双7×20 6*/n";
cout<<"*大熊猫×100或50 7*/n";
cout<<"*确定所压分数 8*/n";
cout<<"*充值 9*/n";
cout<<"*退出 10*/n";
cout<<"**************************/n";
cout<<"请选择对象进行压分:";
cin>>ch;
cout<<endl;
switch(ch)
{case 1: {cout<<"压苹果:";cin>>P;p=P;break;}
case 2: {cout<<"压橘子:";cin>>C;c=C;break;}
case 3: {cout<<"压芒果:";cin>>A;a=A;break;}
case 4: {cout<<"压双星:";cin>>S;s=S;break;}
case 5: {cout<<"压西瓜:";cin>>G;g=G;break;}
case 6: {cout<<"压双7 :";cin>>Q;q=Q;break;}
case 7: {cout<<"压熊猫:";cin>>J;m=J;break;}
case 8: {cout<<endl;cout<<endl;
cout<<"压苹果:"<<p<<" 分"<<endl;
cout<<"压橘子:"<<c<<" 分"<<endl;
cout<<"压芒果:"<<a<<" 分"<<endl;
cout<<"压双星:"<<s<<" 分"<<endl;
cout<<"压西瓜:"<<g<<" 分"<<endl;
cout<<"压双7 :"<<q<<" 分"<<endl;
cout<<"压熊猫:"<<m<<" 分"<<endl;
f=f-p-c-a-s-g-q-m;
if(f<0)
{cout<<"很抱歉,您的分数不够! 请返回充值!"<<endl;
}
else
{cout<<endl;
cout<<"->游戏开始..best luck..>>>You"<<endl;
cout<<endl;
for(j=0;j<8;j++)
cout<<"/a";
if(i==2||i==50||i==45||i==74||i==63||i==3||i==4||i==6||i==8||i==10)
{x1=int(rand()/32767.0*10);
n=99+i*3521+f*2;srand(n);
if(x1==1&&(y1%2)==0)
{if(p>0)cout<<"恭喜您!中";
cout<<"**苹果 "<<endl;
f=f+p*5;cout<<"您的分数为:"<<f<<endl;y1++;
}
else if(x1==1&&y1<100)
{if(p>0)cout<<"恭喜您!中";
cout<<"**小苹果 "<<endl;
f=f+p*2;cout<<"您的分数为:"<<f<<endl;y1++;
}
else if(x1==2&&(y2%2)==0)
{if(c>0)cout<<"恭喜您!中";
cout<<"**橘子 "<<endl;
f=f+c*10;cout<<"您的分数为:"<<f<<endl; y2++;
}
else if(x1==2&&y2<80)
{if(c>0)cout<<"恭喜您!中";
cout<<"**小橘子 "<<endl;
f=f+c*2;cout<<"您的分数为:"<<f<<endl; y2++;
}
else if(x1==3&&(y3%2)==0)
{if(a>0)cout<<"恭喜您!中";
cout<<"**芒果 "<<endl;
f=f+a*10;cout<<"您的分数为:"<<f<<endl;y3++;
}
else if(x1==3&&y3<80)
{if(a>0)cout<<"恭喜您!中";
cout<<"**小芒果 "<<endl;
f=f+a*2;cout<<"您的分数为:"<<f<<endl;y3++;
}
else if(x1==4&&(y4%2)==0)
{if(s>0)cout<<"恭喜您!中";
cout<<"**双星 "<<endl;
f=f+s*20;cout<<"您的分数为:"<<f<<endl;y4++;
}
else if(x1==4&&y4<80)
{if(s>0)cout<<"恭喜您!中";
cout<<"**单星 "<<endl;
f=f+s*2;cout<<"您的分数为:"<<f<<endl;y4++;
}
else if(x1==5&&(y5%2)==0)
{if(g>0)cout<<"恭喜您!中";
cout<<"**西瓜 "<<endl;
f=f+g*20;cout<<"您的分数为:"<<f<<endl;y5++;
}
else if(x1==5&&y5<80)
{if(g>0)cout<<"恭喜您!中";
cout<<"**小西瓜 "<<endl;
f=f+g*2;cout<<"您的分数为:"<<f<<endl;y5++;
}
else if(x1==6&&(y6%2)==0)
{if(q>0)cout<<"恭喜您!中";
cout<<"**双7 "<<endl;
f=f+q*20;cout<<"您的分数为:"<<f<<endl;y6++;
}
else if(x1==6&&y6<80)
{if(q>0)cout<<"恭喜您!中";
cout<<"**单7 "<<endl;
f=f+q*2;cout<<"您的分数为:"<<f<<endl;y6++;
}
else if(x1==7&&m<4&&y8<10)
{if(m>0)cout<<"恭喜您!中";
cout<<"**大熊猫 "<<endl;
f=f+m*50;cout<<"您的分数为:"<<f<<endl;y8++;
}
else if(x1==7&&m<=8&&m>4&&y8<20)
{if(m>0)cout<<"恭喜您!中";
cout<<"**小熊猫 "<<endl;
f=f+m*25;cout<<"您的分数为:"<<f<<endl;y8++;
}
else {cout<<"**很抱歉!被吃了分 "<<endl;
cout<<"您的分数还为:"<<f<<endl;}
}
else if(i==0||i==1||i==5||i==7||i==9||i==20||i==30||i==40||i==56||i==89||i==123||i==985||i==200||i==100||i==300)
{x1=int(rand()/32767.0*20);
n=99+i*800+f*3;srand(n);
if(x1==1&&(y1%3)==0)
{if(p>0)cout<<"恭喜您!中";
cout<<"**苹果 "<<endl;
f=f+p*5;cout<<"您的分数为:"<<f<<endl;y1++;
}
else if(x1==1&&y1<100)
{if(p>0)cout<<"恭喜您!中";
cout<<"**小苹果 "<<endl;
f=f+p*2;cout<<"您的分数为:"<<f<<endl;y1++;
}
else if(x1==2&&(y2%3)==0)
{if(c>0)cout<<"恭喜您!中";
cout<<"**橘子 "<<endl;
f=f+c*10;cout<<"您的分数为:"<<f<<endl; y2++;
}
else if(x1==2&&y2<80)
{if(c>0)cout<<"恭喜您!中";
cout<<"**小橘子 "<<endl;
f=f+c*2;cout<<"您的分数为:"<<f<<endl; y2++;
}
else if(x1==3&&(y3%3)==0)
{if(a>0)cout<<"恭喜您!中";
cout<<"**芒果 "<<endl;
f=f+a*10;cout<<"您的分数为:"<<f<<endl;y3++;
}
else if(x1==3&&y3<80)
{if(a>0)cout<<"恭喜您!中";
cout<<"**小芒果 "<<endl;
f=f+a*2;cout<<"您的分数为:"<<f<<endl;y3++;
}
else if(x1==4&&(y4%2)==0)
{if(s>0)cout<<"恭喜您!中";
cout<<"**双星 "<<endl;
f=f+s*20;cout<<"您的分数为:"<<f<<endl;y4++;
}
else if(x1==4&&y4<80)
{if(s>0)cout<<"恭喜您!中";
cout<<"**单星 "<<endl;
f=f+s*2;cout<<"您的分数为:"<<f<<endl;y4++;
}
else if(x1==5&&y5%3==0)
{if(g>0)cout<<"恭喜您!中";
cout<<"**西瓜 "<<endl;
f=f+g*20;cout<<"您的分数为:"<<f<<endl;y5++;
}
else if(x1==5&&y5<80)
{if(g>0)cout<<"恭喜您!中";
cout<<"**小西瓜 "<<endl;
f=f+g*2;cout<<"您的分数为:"<<f<<endl;y5++;
}
else if(x1==6&&(y6%3)==0)
{if(q>0)cout<<"恭喜您!中";
cout<<"**双7 "<<endl;
f=f+q*20;cout<<"您的分数为:"<<f<<endl;y6++;
}
else if(x1==6&&y6>20&&y6<80)
{if(q>0)cout<<"恭喜您!中";
cout<<"**单7 "<<endl;
f=f+q*2;cout<<"您的分数为:"<<f<<endl;y6++;
}
else if(x1==7&&m<4&&y8<10)
{if(m>0)cout<<"恭喜您!中";
cout<<"**大熊猫 "<<endl;
f=f+m*50;cout<<"您的分数为:"<<f<<endl;y8++;
}
else if(x1==7&&m<=8&&m>4&&y8<20)
{if(m>0)cout<<"恭喜您!中";
cout<<"**小熊猫 "<<endl;
f=f+m*25;cout<<"您的分数为:"<<f<<endl;y8++;
}
else {cout<<"**很抱歉!被吃了分 "<<endl;
cout<<"您的分数还为:"<<f<<endl;
}
}
else
{x1=int(rand()/30000.0*30);
n=99+i*865+f*5;srand(n);
if(x1==1&&y1%3==0)
{if(p>0)cout<<"恭喜您!中";
cout<<"**苹果 "<<endl;f=f+p*5;cout<<"您的分数为:"<<f<<endl;y1++;}
else if(x1==1&&y1<100)
{if(p>0)cout<<"恭喜您!中";
cout<<"**小苹果 "<<endl;f=f+p*2;cout<<"您的分数为:"<<f<<endl;y1++;}
else if(x1==2&&(y2%3)==0)
{if(c>0)cout<<"恭喜您!中";
cout<<"**橘子 "<<endl;f=f+c*10;cout<<"您的分数为:"<<f<<endl; y2++;}
else if(x1==2&&y2<80)
{if(c>0)cout<<"恭喜您!中";
cout<<"**小橘子 "<<endl;f=f+c*2;cout<<"您的分数为:"<<f<<endl; y2++;}
else if(x1==3&&(y3%3)==0)
{if(a>0)cout<<"恭喜您!中";
cout<<"**芒果 "<<endl;f=f+a*10;cout<<"您的分数为:"<<f<<endl;y3++;}
else if(x1==3&&y3<80)
{if(a>0)cout<<"恭喜您!中";
cout<<"**小芒果 "<<endl;f=f+a*2;cout<<"您的分数为:"<<f<<endl;y3++;}
else if(x1==4&&(y4%4)==0)
{if(s>0)cout<<"恭喜您!中";
cout<<"**双星 "<<endl;f=f+s*20;cout<<"您的分数为:"<<f<<endl;y4++;}
else if(x1==4&&y4<120)
{if(s>0)cout<<"恭喜您!中";
cout<<"**单星 "<<endl;f=f+s*2;cout<<"您的分数为:"<<f<<endl;y4++;}
else if(x1>8&&x1<16&&y8<=10)
{
if(w%2==0)
{
for (r=0;r<5;r++) cout<<"/a";
cout<<"**喜从天降 !";f=f+(p+c+a+s+g+q+m)*2;cout<<" 您的分数为:"<<f<<endl;
}
if(w%24==0)
{ for (r=0;r<5;r++) cout<<"/a";
cout<<"**喜从天降! ";f=f+(p+c+a+s+g+q+m)*3;cout<<" 您的分数为:"<<f<<endl;
}
cout<<endl;
y7++;
}
else if(x1==5&&(y5%4)==0)
{if(g>0)cout<<"恭喜您!中";
cout<<"**西瓜 "<<endl;
f=f+g*2;cout<<"您的分数为:"<<f<<endl;y5++;
}
else if(x1==5&&y5<120)
{if(g>0)cout<<"恭喜您!中";
cout<<"**小西瓜 "<<endl;
f=f+g*2;cout<<"您的分数为:"<<f<<endl;y5++;
}
else if(x1==6&&(y6%4)==0)
{if(q>0)cout<<"恭喜您!中";
cout<<"**双7 "<<endl;
f=f+q*20;cout<<"您的分数为:"<<f<<endl;y6++;
}
else if(x1==6&&y6<120)
{if(q>0)cout<<"恭喜您!中";
cout<<"**单7 "<<endl;
f=f+q*2;cout<<"您的分数为:"<<f<<endl;y6++;
}
else if(x1==7&&m<4&&y8<10)
{if(m>0)cout<<"恭喜您!中";
cout<<"**大熊猫 "<<endl;
f=f+m*50;cout<<"您的分数为:"<<f<<endl;y8++;
}
else if(x1==7&&m<=8&&m>4&&y8<20)
{if(m>0)cout<<"恭喜您!中";
cout<<"**小熊猫 "<<endl;
f=f+m*25;cout<<"您的分数为:"<<f<<endl;y8++;
}
else
{
if((x1%15)==0&&(x2%5)==0&&x2<80)
{ cout<<endl;
for(x3=0;x3<3;x3++)
cout<<"/a";
cout<<"*****恭喜您!中大三圆*****"<<endl;
cout<<endl;
if(p>0)
{
if((x2%4)==0)
{cout<<"恭喜您!中大苹果";f=f+p*5;y1++;
}
else
{cout<<"恭喜您!中大苹果";f=f+p*2;y1++;
}
}
else
cout<<"**苹果 "<<endl;
if(a>0)
{if((x2%6)==0)
{cout<<"恭喜您!中大芒果";
f=f+p*5;
y3++;}
else
{cout<<"恭喜您!中小芒果";
f=f+p*10;y3++;
}
}
else
cout<<"**芒果 "<<endl;
if(g>0)
{if((x2%6)==0)
{cout<<"恭喜您!中大西瓜";
f=f+p*20;y5++;}
else
{cout<<"恭喜您!中小西瓜";
f=f+p*2;y5++;
}
}
else
cout<<"**西瓜:"<<f<<endl;
//这里有个问提 } 加式一下} 
}
else
{cout<<"**很抱歉!被吃了分 "<<endl;
cout<<"您的分数还为:"<<f<<endl;
}
}
}
}
x2++;
w++;
}break;
case 9: {cout<<endl;
cout<<"请输入要冲值的金额:";
cin>>y9;
f=f+y9;
sum=sum+y9;
}break;
case 10:{cout<<endl;
cout<<"确定要退出请输入Y或y: ";
cin>>h;break;
}
default:{cout<<endl;
cout<<"选择错误! 如果要重新选择请输入数字任意键:";
cin>>ch;break;
}
}
i++;
}
else
{cout<<"分数不足!请进行下一次游戏 "<<endl; h='Y';}
if(sum>1800&&f<300)
{
y1=0;y2=0;
y3=0;y4=0;
y5=0;y6=0;
y7=0;y8=0;
x2=5;
}
}
if(f<=0)
R='S';
else
{
cout<<endl;
cout<<"确定要退出请输入S或s: ";
cin>>R;
}
}
}
void bccd()
//{//这里也有问提 
{ cout<<endl;
cout<<"*********苹果机游戏规则如下:**********"<<endl;
cout<<"本游戏为数字和运气相接和的数字性游戏"<<endl;
cout<<"在游戏开始要对所要选择的水果押分进行,"<<endl;
cout<<"游戏结束您将知道自己所得的分数!"<<endl;
cout<<"苹果机国际标准如下:"<<endl;
cout<<"苹 果 翻 5 倍: 小苹果 翻 2倍 "<<endl;
cout<<"橘 子 翻 10倍: 小橘子 翻 2倍 "<<endl;
cout<<"芒 果 翻 10倍: 小芒果 翻 2倍 "<<endl;
cout<<"双 星 翻 20倍: 单 星 翻 2倍 "<<endl;
cout<<"双 7 翻 20倍: 单 7 翻 2倍 "<<endl;
cout<<"西 瓜 翻 20倍: 小西瓜 翻 2倍 "<<endl;
cout<<"大熊猫 翻 50倍: 小熊猫 翻 25倍"<<endl;
cout<<"被吃了 翻 0倍 "<<endl;
cout<<"**************祝您好运!*****************"<<endl;
}
void zhilibipin()
{ cout<<"未实现!·"<<endl;
}
void mmpaihang(char nac[][14],int b[],int k)
{int i,j,s,c=1;
char na[14];
if(BBB==0)
{cout<<endl;
cout<<"您还没有进行任何记录,故不存在排行榜!请进行数据记录!"<<endl;
cout<<endl;
}
else
{if(k==1)
cout<<"姓名:"<<nac[0]<<" 分数:"<<b[0]<<endl;
else
{
for(i=0;i<(k-1);i++)
for(j=i+1;j<k;j++)
if(b[i]<b[j])
{s=b[i];b[i]=b[j];b[j]=s;
strcpy(na,nac[i]);
strcpy(nac[i],nac[j]);
strcpy(nac[j],na);
}
for(i=0;i<k;i++)
{ if(strcmp(nac[i],"成员")==0)
{ cout<<"姓名:"<<setw(14)<<nac[i]<<c<<" 分数:"<<b[i]<<endl;c++;}
else
cout<<"姓名:"<<setw(14)<<nac[i]<<" 分数:"<<b[i]<<endl;
}
}
}
BBB++;
}
void lingsheng()
{cout<<"未实现!·"<<endl;}
void shezhi()//设置;
{char m[50],mm[50],mk[50],mc[50];
int ww=10,h,ggg=5,gg,kk;
char k='n';
cout<<"请输入密码:";
cin>>m;
while(k!='y'&&k!='Y')
{while(ww<=10&&ww>0)
{ ww--;
if(strcmp(m,mi)==0)
{cout<<"************设置*************/n";
cout<<"*时间设置 *1/n";
cout<<"*显示设置 *2/n";
cout<<"*彩灯设置 *3/n";
cout<<"*IP 设置 *4/n";
cout<<"*快速拨号 *5/n";
cout<<"*话机设置 *6/n";
cout<<"*PIM 设置 *7/n";
cout<<"*修改密码 *8/n";
cout<<"*找回密码 *9/n";
cout<<"*密码DNA *10/n";
cout<<"*退出设置 *11/n";
cout<<"*****************************/n";
cout<<"请选择服务类型:" ;
cin>>h;
if(h<8) cout<<"位实现此功能!"<<endl;
else if(h==8)
{ cout<<"请输入新密码:";cin>>mm;
cout<<"请再次输入新密码";cin>>mk;
while(strcmp(mi,mk))
{if(strcmp(mm,mk)==0)
{cout<<"密码修改成功 ! 请保管好您的密码!"<<endl;
cout<<"/n";
strcpy(mi,mm);
strcpy(m,mm);
}
else
{cout<<"两次输入不一致!退出修改请选择1 继续进行选择2!"<<endl;
cin>>gg;
switch(gg)
{
case 1: strcpy(mi,mk);
cout<<"退出成功!"<<endl;break;
case 2: cout<<"请输入新密码:";
cin>>mm;
cout<<"请再次输入新密码";
cin>>mk;break;
}
}
}
}
else if(h==9)
{while(ggg<=5)
{cout<<wenti;
cin>>mc;
ggg--;
if(strcmp(mc,huida)==0)
{ cout<<"您的密码为:"<<mi<<endl;
ggg=6;}
else
{cout<<"问题回答错误!您还有"<<ggg<<"次机会"<<endl;
cout<<wenti;
cin>>mc;}
}
}
else if(h==10)
{
cout<<"请选择您要设置的问题"<<endl;
cout<<"*************************/n";
cout<<"*您的姓名是什么? *1/n";
cout<<"*您的学号是什么? *2/n";
cout<<"*您的生日是什么? *3/n";
cout<<"*您的父亲姓名是? *4/n";
cout<<"*您的女朋友姓名是? *5/n";
cout<<"*您的母亲姓名是? *6/n";
cout<<"*************************/n";
cout<<"请选择:";
cin>>kk;
switch(kk)
{case 1:{strcpy(wenti,"您的姓名是什么?");
cout<<"您的姓名是什么?";
cin>>huida;}break;
case 2:{strcpy(wenti,"您的学号是什么?");
cout<<"您的学号是什么?";
cin>>huida;}break;
case 3:{strcpy(wenti,"您的生日是什么?");
cout<<"您的生日是什么?例 1988.02.03 ";
cin>>huida;}break;
case 4:{strcpy(wenti,"您的父亲姓名是?");
cout<<"您的父亲姓名是?";
cin>>huida;}break;
case 5:{strcpy(wenti,"您的女朋友姓名是?");
cout<<"您的女朋友姓名是?";
cin>>huida;}break;
case 6:{strcpy(wenti,"您的母亲姓名是?");
cout<<"您的母亲姓名是?";
cin>>huida;}break;
}
}
else
{cout<<"确定要退出设置 请输入Y或y: ";
cin>>k;
ww=11;
}
}
else
{ cout<<endl;
cout<<"您输入的密码错误!您还有"<<ww<<"次机会"<<endl;
cout<<"请再次输入密码:";
cin>>m;
}
}
}
}
void lingtongwusheng()
{cout<<"未实现!·"<<endl;}
void zengzhifuwu()
{cout<<"未实现!·"<<endl;}
void dadianhua()
{cout<<"未实现!·"<<endl;}
//明天修改!!!游戏出问题;要用全局变量

你可能感兴趣的:(c/c++)