1331com银河游戏

cԿγܽ

cԿγܽ

ƽ̨ûĻоѡcԿγܽصģ1c γ 3ҪCԳ鱨Сᣬ˭У 4ѧɼ¼ c γƱ 5оCԿγƺû 9CԿγ 10CԿγ ̰
cԿγܽ
ƽ̨û 2018-06-06 17:02:05

Ǿѡƽ̨ûʱ

184***@qq.com
184***@qq.com


184***@qq.comc γ

һγ̹ϵͳϵͳвѯ룬棬ȹܡϵͳһ˵棬ɹѡ񡣶γ̽ṹͣ鱣γϢָ뷽ʽзʡֱܺṩѯ룬棬ȹܡѯܱɷֱ𰴿γ̱š... һγ̹ϵͳϵͳвѯ룬棬ȹܡϵͳһ˵棬ɹѡ񡣶γ̽ṹͣ鱣γϢָ뷽ʽзʡֱܺṩѯ룬棬ȹܡѯܱɷֱ𰴿γ̱šγƵȲвѯļʽϢܱɰѧʱλȡ鷳184188719@qq.com
Ľѱ6706˵

ã
  и򣬿Ҫ㿴ɣԸҪ޸ij

һα༭ʱ 2015-06-30
溢ؼQ
溢ؼQ


溢ؼQҪCԳ鱨Сᣬ˭У

Ľѱ2577˵
ͨһƺʵ֣ҶMicosoft Visual C++һ˽⣬𽥿ʼMicosoft Visual C++Ĺ棬ԼÿһݼϤʶϤЩݼΪݱд򣬵ǻҪϤ ʱҪõķעͬݵͶ롣ʹ£ԿٲұݵIJҵУںܺõ޸ġ ͨαĸܵԴıע͸ʽǶijȺͺĿֶȷ涨õıдϰߣڴֲ;ҲڲͬԱ֮Э Ҫ漰CеĽṹ塢ָ뼰ļݣֻгCеĽṹ塢ָ뼰ļݣп֯Щ룬ʹ֮߼õĽ ܽᣬҲѧϰһ֣ÿһһδ룬ӦĿĵĸٸóӦ״ʱܽᣬҵԼIJ㣬дijߣˮԤʾŽҲ֤ջͶ㲻Ļ⡣ͨʵʶDzԵܶһʵ壬˵ȷʵЩ࣬Ҳ֣ŶӵУһĹ˵Ц໥ĬǶԣ֪ʶϵջҪϵķǿϲġһݲƸһӵСʵʲؽΪ;һdzõĻ䣡 ع˴ογƣԸпĶ࣬ȷԴõĿ̣۵ʵµѧܶܶĶͬʱԹǰѧ֪ʶѧ˺ܶ鱾ûѧ֪ʶͨογʹҶʵǺҪģֻ֪ʶԶԶģֻаѧ֪ʶʵеóۣΪ񣬴ӶԼʵʶͶ˼ƵĹ⣬˵أϾһģָ⣬ͬʱƵĹзԼIJ֮һЩǰѧ֪ʶọ̀յòι̣˵ṹ壬ָ롭ͨογ֮Ұǰѧ֪ʶ¹һ顣 ͬʱ*ʦѧõܶʵõ֪ʶڴ˱ʾлͬʱԸҰͬѧָʦٴαʾĵĸл
һα༭ʱ Ƽ2017-09-20 10:16:58
ֻ
ֻ


ֻأѧɼ¼ c γƱ

Ŀ ѧɼ¼2ɣ һCԳɼ¼ÿѧϢѧšCԳɼ幦ܣ 1ϢԴļ棻 2ȡļʾѧijɼ 3ѧŻѯɼ ... Ŀ
ѧɼ¼2ɣ
һCԳɼ¼ÿѧϢѧšCԳɼ幦ܣ
1ϢԴļ棻
2ȡļʾѧijɼ
3ѧŻѯɼ
4ӳɼ¼
5޸ָѧŵѧijɼɴ̣
6ʾ60¡60~7980~8990ϸεѧϢ
׿γƱ棬
Ľѱ9885˵
CԳƱ

:ѧɼ

1 ϵͳ:

Ϊһѧɼϵͳ,ѧijɼй,ѧϢѧ,,ѧ,ſγ̵ijɼ,ЩϢ,Զܳɼ,԰߷ֵͷֽ,Ϣл.

2 ݽṹ:

(1)ṹ;

(2):ָ,ʹָԱ,ʹӼ,ɶԸǿ.

3 :

ԭͣvoid InitList(SqLinkList &L)

ܣ һյ

ڲLΪҪ

ڲL.headΪգL.lengthΪ0

ֵ ޣ

ԭͣvoid EmptyLinkList(SqLinkList &L)

ܣ

ڲLΪҪյƣ

ڲճɹL.lengthΪ0

ֵ ޣ

ԭͣint ScanE(ElemType &e)

ܣ ѧϢ

ڲeΪҪϢѧƣ

ڲe.numѧţe.namee.teamѧڣe.s1e.s2e.s3ֱ𱣴ſγ̵ijɼ

ֵ Ϸ1򷵻0

ѧš벻Ϸʾ䣻

ԭͣStatus SqLinkListAppend(SqLinkList &L,ElemType e)

ܣ ׷һ㵽У

ڲeΪ׷ӵĽƣLΪe׷ӵƣ

ڲ׷ӳɹeΪͷ㣬L.length1

ֵ ׷ӳɹ1

ԭͣLink SearchNode(SqLinkList L,int NUM)

ܣ ѧΪNUMѧ

ڲҵLѧNUM

ڲҵָpָý㣬ָս㣻

ֵ ָp

ԭͣvoid SearchTeam(SqLinkList L,int team)

ܣ ѧΪteamм¼Ϣ

ڲҵLҪҵѧteam

ڲޣ

ֵ ޣ

ԭͣvoid SearchUnpass(SqLinkList L,float s1,float s2,float s3)

ܣ йҿƼ¼ѧϢ

ڲҵLҪҵĸѧƳɼs1,s2,s3;

ڲޣ

ֵ ޣ

ԭͣvoid SqLinkListSearch(SqLinkList L)

ܣ зң

ڲҪҵL

ڲޣ

ֵ ޣ

ԭͣ void inputData(SqLinkList &L)

ܣ ݣ׷һ㣻

ڲ LΪҪ׷ӽƣ

ڲ ޣ

ֵ ޣ

ԭͣvoid SqLinkListTraverse(SqLinkList L)

ܣ ѧɼб

ڲLΪҪϢƣ

ڲޣ

ֵ ޣ

ԭͣvoid PrintE(ElemType e)

ܣ һϢ

ڲҪĽe

ڲޣ

ֵ ޣ

4 ʹó˵:

ΪһѧɼϵͳѧijɼϢйѧϢѧšѧڡſγ̵ijɼƽɼΡϵͳʵѧѧšѧڡÿſγ̵ijɼ¼룬Զƽ,ʹʱĻϵʾ,ʹô.ͼʾ:

:֡1,ִСѧɼѴڵѧɼ޸ġС.ѧϢ,ͼʾ:

˷ֱӦij,ִӦij.

µijǰѧŽгɼ:

롱6ʱ,ִӦij,һѧ:

5 ܽ:

ͨCѧϰ,ѧڱ࿪չC˫ѧ,ᵽѧϰѵͬʱ,Ҳ˽⵽CΪһŸ߼ļԵǿ,رڵʵ,,칫,Ϣȷǿ. κѡʱĽȣ֪ʶIJ㣬ҺܴѹһǻŽеĸܡ

6 :

void InitList(SqLinkList &L) {

// һյԱL

L.head = 0; //ͷָΪգ

L.length = 0; //ȳʼΪ0

}

void EmptyLinkList(SqLinkList &L){

//ڲΪԱݣΪԱ

Node *p;

if(!L.head)printf("ϵͳвڼ¼\n");

//ͷָΪʱûѧ¼룻

else {

while (L.head){

//ÿѭһ㸳ֵͷָ룬ͷűռ䣬ֱԱգ

p=L.head;

L.head=p->next;

free(p);

} //end while;

L.length=0; //Ϊ0;

printf("ùϵͳѧϢա\n");

}//end else;

}

int ScanE(ElemType &e){

//һѧijɼݽ㡣0ΪЧݣ1ΪЧݣ

printf("\nѧ:");

scanf("%d",&e.num);

if(e.num==0){

//ѧΪ0벻Ϸ룻

printf("ѧ벻Ϸ.\n");

return 0;

}

printf("\n:");

scanf("%s",&e.name);

printf("\nѧ:");

scanf("%d",&e.team);

while(e.team>12){

//ϵͳֻ¼С12ѧ

printf("ѧڲܴ12:");

scanf("%d",&e.team);

}

printf("\nɼA:");

scanf("%f",&e.s1);

printf("\nɼB:");

scanf("%f",&e.s2);

printf("\nɼC:");

scanf("%f",&e.s3);

return OK;

}

Status SqLinkListAppend(SqLinkList &L,ElemType e){

//׷һ㵽ԱУ

Node *p;

p=SearchNode(L,e.num);

//ѧΪe.numļ¼ַָp;

if (p==0){

//ѧͬĽ㣬׷һ㣻

p=(Node *)malloc(sizeof(Node));

if (!p) return ERROR;

memcpy(&(p->data),&e,sizeof(ElemType));

p->next=L.head ;

L.head=p;

//׷ӵһΪ׽㣻

L.length++; //ȼ1

}

else { //ѧż¼Ѵڣ޸IJ

memcpy(&(p->data),&e,sizeof(ElemType));

printf("ѧ¼Ѿڣ޸IJ\n");

}

return OK;

}

Link SearchNode(SqLinkList L,int NUM){

//ѧ¼,ѧѧΪNUM

Node *p;

p=L.head; //pָͷ;

while (p&& p->data.num !=NUM ) p=p->next;

//ѧѧŲΪNUMһ㣻

return p;

}

void SearchTeam(SqLinkList L,int team){

//ѧڲҲиѧڴڵļ¼

Node *p;

p=L.head;

int n,sum=0;

//sum¼ѧڵѧ

printf("Ҫѯѧѧ:");

scanf("%d",&n);

printf("\nѧ ѧ ɼA ɼB ɼC ƽɼ\n");

while(p&&p->next){

//pһ㲻ΪգҸýѧڵҪѧڣʽиѧѧϢ

if(p->data.team==n){

PrintE(p->data);

sum++;

//ҵһѧڵѧ¼1

}

p=p->next;

//תһ㣻

} //end while;

if(p->data.team==n){

//pһΪգұѧΪnʽýϢ

sum++;

PrintE(p->data);

}

if(sum==0)printf("ûѧڵļ¼\n");

if(sum)printf("ѧڹ%d˵ļ¼.\n",sum);

}

void SearchUnpass(SqLinkList L,float s1,float s2,float s3){

//ҲйҿƵѧϢ

Node *p;

p=L.head;

int sum=0;

//sumҿʼΪ0

printf("һϲĿѧijɼ:\n");

printf("\nѧ ѧ ɼA ɼB ɼC ƽɼ\n");

while(p&&p->next){

//pһΪ棬ҸýһϿĿ60ýɼʹsum1

if((p->data.s1<60)||(p->data.s2<60)||(p->data.s3<60))

{

PrintE(p->data);

sum++;

} //end if;

p=p->next;

//תһ㣻

} //end while;

if((p->data.s1<60)||(p->data.s2<60)||(p->data.s3<60)){

//鿴һ㣬йҿƣsum1ʽϢ

sum++;

PrintE(p->data);

}

if(sum==0)printf("ûвļ¼\n");

if(sum)printf("%d˵ĹҿƼ¼.\n",sum);

}

void SqLinkListSearch(SqLinkList L){

//ѧ¼

Node *p;

p=L.head;

int n,reg; //regΪѯʽָ;

printf("1--ѧŲѯ\n2--ѧڲѯ\n3--ҿѧϢб\n");

printf("ѯʽ:");

scanf("%d",®);

if(L.length){

if(reg>3)printf("ԲûҪѡ\n");

//reg>3벻Ϸ

else if(reg==1){

//reg==1ѧŲѯ

printf("Ҫѯѧѧ:");

scanf("%d",&n);

while(p&&p->next&& p->data.num !=n) p=p->next;

//pһΪʱҽݲΪҪʱתһ㣻

if(p->data.num==n){

//ҵҪѯ㣬ʽ

printf("\nѧ ѧ ɼA ɼB ɼC ƽɼ\n");

PrintE(p->data);

}

else printf("ûҪҵѧš\n");

} //end reg==1 if ;

else if(reg==2)SearchTeam(L,p->data.team);

//reg==2,SearchTeamѧڲѯ;

else if(reg==3)SearchUnpass(L,p->data.s1,p->data.s2,p->data.s3);

//reg==3SearchUnpassȫйҿƼ¼ѧϢ

}//end if;

else printf("ϵͳ޼¼.\n");

}

void inputData(SqLinkList &L){

//ѧɼ׷һ㲢룻

ElemType e;

if (ScanE(e)) SqLinkListAppend(L,e); //ݣ׷һ㣻

}

void SqLinkListTraverse(SqLinkList L){

//ѧϢб

Node *p;

char c;

p=L.head;

if(p) //ǿձ;

{

printf("\nѧ ѧ ɼA ɼB ɼC ƽɼ\n");

for (p=L.head ;p;p=p->next )PrintE(p->data);

//ӵһ㿪ʼϢֱΪգ

}

else printf("ϵͳ޼¼\n");

//ձ;

c=getchar();

}

void PrintE(ElemType e){

//Ƴɼƽɼ

printf("%d\t%s\t%d\t%f\t%f\t%f\t%f\n",e.num,e.name,e.team,e.s1,e.s2,e.s3,(e.s1+e.s2+e.s3)/3);

//ʽѧѧšѧڡABCųɼԼƽɼ

}
һα༭ʱ Ƽ2016-08-10 03:58:16
2084
2084


2084оCԿγƺû

Ľѱ203˵
У˴ѧcԸʲôҪʱѪ
һα༭ʱ 2017-12-30
о²
о²


о²ˣCԿγ

Ŀ ɻƱơ ܣ ɻ80λΪ20ţÿ4λӡΪA,B,C,D10Dʾ10DAD1920Ϊϵͳó˿Լѡźֱ˿Ϊֹ޷ĻֻܸijһࡣƱij˿Ҫ... Ŀ ɻƱơ

ܣ ɻ80λΪ20ţÿ4λӡΪA,B,C,D10Dʾ10DAD1920Ϊϵͳó˿Լѡźֱ˿Ϊֹ޷ĻֻܸijһࡣƱij˿Ҫ֤ţҪӡ˿嵥

ֲʵʩ

1ƣÿܣȷ˻ԻĽ棬ȷ
2Ҫ󣺽һСϵͳ5λܹ˿ѡ
3һҪȫܵϵͳ

Ҫ 1Cʵֳƣ
2ýṹʵϢݽṹƣ
3ϵͳĸģҪúʽʵ֣
4Ѻãõ˻ӱҪע͡

γ鱨Ҫ

1Ԥϰ棺Ŀγݽṹƣ㷨ģ黮֡
2ʵܽᱨ棺ͼҪԴ루ӡСȡ
Ľѱ3307˵
÷ˣע] 
--------------------------------------------------------
//#include
#include < conio.h>
#include
#include
#include
#define OK 1
#define TRUE 1
#define FALSE 0
#define ERROR 0
#define OVERFLOW -2
#define PR printf
typedef int status;
typedef struct airline
{
char line_num[8];//
char plane_num[8];//ɻ
char end_place[20];//Ŀĵ
int total;//λ
int left;//ʣλ
struct airline *next;//һ
}airline;
typedef struct customer
{
char name[9];//˿
char line_num[8];//
int seat_num;//λ
struct customer *next;//һ
}customer;
airline *init_airline()
{ //ʼ
airline *l;
l=(airline*)malloc(sizeof(airline));
if(l==NULL)
{ exit(0);
}
l->next=NULL;
return l;
}
customer * init_customer(){//ʼ
customer *l;
l=(customer*)malloc(sizeof(customer));
if(l==NULL){
exit(0);
}
l->next=NULL;
return l;
}
status insert_airline(airline **p,char *line_num,char *plane_num,char *end_place,int total,int left){//airline
airline *q;
q=(airline*)malloc(sizeof(airline));
strcpy(q->line_num , line_num);
strcpy(q->plane_num , plane_num);
strcpy(q->end_place , end_place);
q->total =total;
q->left =left;
q->next=NULL;
(*p)->next=q;
(*p)=(*p)->next;
// PR("insert %d ,%dis succssed!\n",e,bl);
return OK;
}
status insert_customer(customer **p,char *name,char *line_num,int seat){//customer
customer *q;
q=(customer*)malloc(sizeof(customer));
/* { PR("ڴʧ\n");
return OVERFLOW; }*/
strcpy(q->name , name);
strcpy(q->line_num , line_num);
q->seat_num =seat;
q->next=NULL;
(*p)->next=q;
(*p)=(*p)->next;
// PR("insert %d ,%dis succssed!\n",e,bl);
return OK;
}
airline *modefy_airline(airline *l,char *line_num)//޸airlineе
{ airline *p;
p=l->next ;
for(;p!=NULL;p=p->next )
{ if(strcmp(line_num,p->line_num )==0)
{ p->left ++;
// PR("modefy %s\n",p->line_num );
return l;
}
}
PR("û࣬޷޸\n");
return 0;
}
status delete_airline(airline *h,char *line_num)//ɾ
{ airline *p,*pr;
pr=h;
p=pr->next ;
while(p!=NULL)
{ if(strcmp(line_num,p->line_num )==0)
{ pr->next =p->next ;
PR("ɾ %s \n",p->line_num );
return OK;
}
pr=pr->next ;
p=pr->next ;
}
PR("޴˺࣬޷ɾ\n");
return ERROR;
}
status delete_customer(customer *h,char *line_num)//ɾ˿
{ customer *p,*pr;
pr=h;
p=pr->next ;
while(p!=NULL)
{ if(strcmp(line_num,p->line_num )==0)
{ pr->next =p->next ;
}
pr=pr->next ;
p=pr->next ;
}
// PR("޴˺࣬޷ɾ\n");
return OK;
}
status delete_cus(customer *h,airline *l,char *name)//˿Ʊ
{ customer *p,*pr;
char line_num[8];
// qr=h;
pr=h;
p=pr->next ;
// PR("ʼɾ\n");
while(p!=NULL)
{ if(strcmp(name,p->name )==0)
{ strcpy(line_num,p->line_num );
l=modefy_airline(l,line_num);
pr->next =p->next ;
PR("˿ %s Ʊɹ!\n",p->name );
return OK;
}
pr=pr->next ;
p=pr->next ;
}
PR("޴˹˿ͣ޷Ʊ\n");
return ERROR;
}
status save_airline(airline *l)//airline.dat
{ FILE *fp_airline;
char ch='#';
airline *p=l->next ;
char filename[]="c:\\airline.dat";
if((fp_airline=fopen(filename,"wb"))==NULL)
{ printf("can not open file to write:%s\n",filename);
return ERROR;
}
for(;p!=NULL;p=p->next )
{ // printf("%s,%s,%s,%d,%d\n",p->line_num ,p->plane_num ,p->end_place ,p->total ,p->left );
fprintf(fp_airline,"%s,%s,%s,%d,%d%c\n",p->line_num ,p->plane_num ,p->end_place ,p->total ,p->left ,ch);
}
fclose(fp_airline);
return OK;
}
status save_customer(customer *l)//˿Ϣ customer.dat
{ FILE *fp_customer;
char ch='#';
customer *p=l->next ;
char filename[]="c:\\customer.dat";
if((fp_customer=fopen(filename,"wb"))==NULL)
{ printf("can not open file to write:%s\n",filename);
return ERROR;
}
for(;p!=NULL;p=p->next )
{ // PR("%s,%s,%d\n",p->name ,p->line_num ,p->seat_num );
fprintf(fp_customer,"%s,%s,%d%c",p->name ,p->line_num ,p->seat_num ,ch);
}
fclose(fp_customer);
return OK;
}
int changStrInt(char *ch)//ַתΪ
{ int a=1,b=0,c=0,i;
for (i=strlen(ch)-1;i>=0;i--)
{ if (ch[i]<58&&ch[i]>47)
{ b=a*(ch[i]-48);
a=a*10;
c=c+b;

}
else
{ PR("%c Ϸ,޷ַתΪ!\n",ch[i]);
return 0;
}
// printf("the c is %d\n",c);
}
return c;
}
status insert_air(airline *l,char *line_num,char *plane_num,char *end_place,int total,int left){//airline
airline *q;
q=(airline*)malloc(sizeof(airline));
strcpy(q->line_num , line_num);
strcpy(q->plane_num , plane_num);
strcpy(q->end_place , end_place);
q->total =total;
q->left =left;
q->next=l->next ;
l->next=q;
// PR("insert %d ,%dis succssed!\n",e,bl);
return OK;
}
status insert_cus(customer *l,char *name,char *line_num,int seat){//customer
customer *q;
q=(customer*)malloc(sizeof(customer));
strcpy(q->name , name);
strcpy(q->line_num , line_num);
q->seat_num =seat;
q->next=l->next ;
l->next=q;
return OK;
}
status load_airline(airline *l)
{ FILE *fp_airline;
int flag=0,i=0;
char ch;
char line_num[8];//
char plane_num[8];//ɻ
char end_place[20];//Ŀĵ
char total_str[5];
char left_str[5];
int total;//λ
int left;//ʣλ
// airline *p=l;
char filename[]="c:\\airline.dat";
if((fp_airline=fopen(filename,"rb"))==NULL)
{ printf("can not open file to load:%s\n",filename);
return ERROR;
}
while(!feof(fp_airline))
{ ch=fgetc(fp_airline);
if(ch!='#')
{ if(flag==0&&ch!=',')
{ line_num[i]=ch;
i++;
}
else if(flag==1&&ch!=',')
{ plane_num[i]=ch;
i++;
}
else if(flag==2&&ch!=',')
{ end_place[i]=ch;
i++;
}
else if(flag==3&&ch!=',')
{ total_str[i]=ch;
i++;
}
else if(flag==4&&ch!=',')
{ left_str[i]=ch;
i++;
}
else if (ch==',')
{ flag++;
i=0;
}
/* else
{ PR("\n");
return ERROR;
}*/
}
else
{ flag=0;
i=0;
total=changStrInt(total_str);
left=changStrInt(left_str);
PR("%8s%8s%8s%9d%9d\n",line_num ,plane_num ,end_place ,total ,left );
insert_air(l,line_num,plane_num,end_place,total,left);
}
}
fclose(fp_airline);
return OK;
}
status load_customer(customer *l)
{ FILE *fp_customer;
int flag=0,i=0;
char ch;
char name[9];
char line_num[8];//
char seat_num_str[5];
int seat_num;//λ
// customer *p=*l;
char filename[50]="c:\\customer.dat";
if((fp_customer=fopen(filename,"rb"))==NULL)
{ printf("can not open file to load:%s\n",filename);
return ERROR;
}
while(!feof(fp_customer))
{ ch=fgetc(fp_customer);
printf("%c\n",ch);
if(ch!='#')
{ if(flag==0&&ch!=',')
{ name[i]=ch;
i++;
}
else if(flag==1&&ch!=',')
{ line_num[i]=ch;
i++;
}
else if(flag==2&&ch!=',')
{ seat_num_str[i]=ch;
i++;
}
else if (ch==',')
{ flag++;
i=0;
}
else
{ PR("\n");
return ERROR;
}
}
else
{ flag=0;
seat_num=changStrInt(seat_num_str);
PR("%10s %10s %d\n",name ,line_num ,seat_num );
insert_cus(l,name,line_num,seat_num);
// p=p->next ;
}
}
fclose(fp_customer);
return OK;
}
status creat_airline(airline **l)//airline
{ airline *p=*l;
int i=0;
char *line_num[3]={"bjnc01","bjsh02","shgz03"};
char *plane_num[3]={"plane1","plane2","plane3"};
char *end_place[3]={"nc","sh","gz"};
int total[3]={100,100,100};
int left[3]={51,50,78};
for (i=0;i<3;i++){
insert_airline(&p,line_num[i],plane_num[i],end_place[i],total[i],left[i]);
}
return OK;
}
status creat_customer(customer **l)////customer
{ customer *p=*l;
int i=0;
char *name[3]={"ouyangj0","yhl","fs"};
char *line_num[3]={"bjnc01","bjsh02","shgz03"};
int seat_num[3]={1,5,10};
for (i=0;i<3;i++){
insert_customer(&p,name[i],line_num[i],seat_num[i]);
}
return OK;
}
status increase_air(airline *l,char *line_num,char *plane_num,char *end_place,int total)//Ӻ
{ airline *p=l->next ;
for(;p->next !=NULL;p=p->next){}
insert_airline(&p,line_num,plane_num,end_place,total,total);
PR("Ӻ %s ɹ!\n",line_num);
return OK;
}
status book(airline *l,char *line_num,customer *c,char *name)//Ʊ
{ airline *p=l;
customer *q=c->next ;
p=l->next ;
for(;q->next !=NULL;q=q->next){}
// PR("%s\n",q->name );
for(;p!=NULL;p=p->next )
{ if(strcmp(line_num,p->line_num )==0)
{ if(p->left >0)
{ PR("ϲ!Ʊɹ!\n");
PR("λ: %d\n",(p->total -p->left +1));
insert_customer(&q,name,line_num,p->total -p->left +1);
p->left --;
return OK;
}
else PR("Բ,λ!\n");
return 0;
}
}
PR("Բ,û!\n");
return ERROR;
}
status print_airline(airline *l)//ӡϢ
{ airline *p=l->next ;
for(;p!=NULL;p=p->next )
{ PR("%8s%8s%8s%9d%9d\n",p->line_num ,p->plane_num ,p->end_place ,p->total ,p->left );
}
return OK;
}
status print_customer(customer *l)//ӡ˿Ϣ
{
customer *p=l->next ;
for(;p!=NULL;p=p->next )
{ PR("%10s %10s %d\n",p->name ,p->line_num ,p->seat_num );
}
return OK;
}
status inputpassword(char cc[9])//Ϊ*ŵĺ -------------------¥ע
{
char c;
int i;
for(i=0;c=getch();i++)
{
if(c==13) break; /*13ǻسascii룬'\n'У֪ô*/
else
{
cc[i]=c;
printf("*");
}
}
cc[i]='\0';
//printf("\n");
//printf("%s",cc);
//getchar();
return strlen(cc);
}
void main()
{ char choice,choice2,name[9],line_num[8],password[9],plane_num[8],end_place[9];
char pass[9]="19851102",re_pass_1[9],re_pass_2[9];
int t=1,tt=1,total;
airline *air=init_airline();
customer *cus=init_customer();
PR(" 0541γ (һ)\n");
PR(" նƱϵͳ\n");
PR(" Ա:̿\n");
creat_airline(&air);
creat_customer(&cus);
// save_airline(air);
// save_customer(cus);
while(t==1)
{ PR("*----------------------------*\n");
PR("*--նƱϵͳѡ˵------*\n");
PR("* Ʊ-------0 *\n");
PR("* Ʊ-------1 *\n");
PR("* ѯ-------2 *\n");
PR("* ޸ĺ---3 *\n");
PR("* ļ---4 *\n");
PR("* ˳-------5 *\n");
PR("*----------------------------*\n");
PR("ѡ: ");
choice = getch();
PR("%c\n",choice);
if(choice=='0')
{ PR("Ҫĺ: ");
scanf( "%s",line_num);
PR(": ");
scanf( "%s",name);
book(air,line_num,cus,name);
save_airline(air);
save_customer(cus);
}
else if(choice=='1')
{ PR("\n: ");
scanf( "%s",name);
delete_cus(cus,air,name);
save_airline(air);
save_customer(cus);
}
else if(choice=='2')
{ PR("\n ɻ Ŀĵ Ʊ Ʊ\n");
print_airline(air);
PR(" λ\n");
print_customer(cus);
}
else if(choice=='3')
{ tt=1;
PR(": ");
//scanf("%s",password);
inputpassword(password);-----------------¥עҸˣ

if(strcmp(password,pass)==0)
{ while (tt==1){
PR("\n*------------------------------*\n");
PR("*-------Ϣ޸:----------*\n");
PR("* Ӻ-----'0' *\n");
PR("* ɾ-----'1' *\n");
PR("* ޸-------'2' *\n");
PR("* ѯϢ---'3' *\n");
PR("* ˳޸---'4' *\n");
PR("*------------------------------*\n");
PR("ѡ: ");

choice2=getch();
PR("%c\n",choice2);
if(choice2=='0')
{ PR("Ҫӵĺ: ");
scanf("%s",line_num);
PR("ɻ: ");
scanf("%s",plane_num);
PR("Ŀĵ: ");
scanf("%s",end_place);
PR("λ: ");
scanf("%d",&total);
increase_air(air,line_num,plane_num,end_place,total);
save_airline(air);
save_customer(cus);
}
else if (choice2=='1')
{ PR("Ҫɾĺ: ");
scanf("%s",line_num);
delete_airline(air,line_num);
delete_customer(cus,line_num);
save_airline(air);
save_customer(cus);
}
else if(choice2=='2')
{ PR("ע:벻ܳ8λ!\n");
PR("룺");
scanf("%s",re_pass_1);
PR("һ: ");
scanf("%s",re_pass_2);
if(strcmp(re_pass_1,re_pass_2)==0)
{ strcpy(pass,re_pass_1);
PR("޸ijɹ!ס.\n");
}
else { PR("벻һ!\n");
}
}
else if(choice2=='3')
{ PR("\n ɻ Ŀĵ Ʊ Ʊ\n");
print_airline(air);
}
else if(choice2=='4')
{ tt=0;
}
else {
PR("\n");
tt=0;
}
}//end while
}//end if
else {
PR("Բ!벻ȷ!\n");
}
}//end else if ޸
else if(choice=='4')
{ load_airline(air);
load_customer(cus);
}
else if(choice=='5')
{ PR("ټ!");
t=0;
}
else
{ PR("\n");
}
}
getch();
}
һα༭ʱ Ƽ2016-09-08 11:55:42
ľ
ľ


ľCԿγ ̰

Ҫһ Ŀ˼
õҪѵͽ
ʵֵҪܺϵͳṹ
ġĵ
塢㷨ؼ˵
ѧУҪDZһ̰ߵϷҪдĵᣬȫɵĻҿͽлл
Ľѱ8314˵

2.1ܽ

̰ϷһСϷһڷΧǽΧǽһʳͨĸĸƶͷײʳʳﱻԵ峤һڣͬʱ10ֳ֣ʳȴԣƶײǽ彻ͷײԼϷ

2.2˵

һϷҪпʼ֣в֣֣ʵϿʼвһģ

2.2.1˼·

ĹؼDZʾߵͼԼߵƶһСαʾߵһ壬ÿһڣһο飬ͷڱʾƶʱͷʼ߲෴ƶҲβܸͷκμڵǰǰƣϷ߰Чķͷָķƶһƶһ壬ԵЧķȷͷλãȻͷƶͼεʵǴͷλÿʼߣʱûƽԭԭߵλúߵλòһλԿһ壬ԽߵһñɫǡʳijֺʧҲǻο͸Ǿο

2.2.2ݽṹƼ÷˵ 

ʼ֣

ϷͼģʽµģԵһһdzʼͼģʽҪпʼĽ棬зһһϷı⻭棬Ϸ⻭һһӭ档⻭Ժ󣬻ҪΪϷвʼϷʱıϷijЩ Ҫijʼ

в֣

ΪϷĺIJ֣ĺȽ϶࣬ҲģȽ϶࣬ģһ̰ߵϷģʽijͻȻһߣ̣ܶ˶쳣ûֹͣԼĶදֻ֢ʳܶҲ̰ԣͬڲԭ£ʳϧû䵽ߣ˹ûжҲʳֱʳȥԵʳͬʳܿijΪԼһ֣ӱ䳤Եһʳʱϵиڶţ˵ڶţֱ䳤ˣеšһֱļӳԼ鷳ת㣬ȥֱӰѰŴ󣬺ʳиɫͨij磬ҧԼԼһߣȥǶֻʳʱʧȥƣײǽϡ

һѭһʳڶ߲ͣ˶ײԼǽڣɵIJϷ֧ߣAB

A IJûԼǽڣ߼ǰߵĶ岽жǷԵʳ߳Եʳӱ䳤ԭʳʧָһѭĵڶı˶򣻵߲ڶѭĵһظһֵIJ裻

BIJԼǽڣֹϷ

֣

ϷʱʾGAME OVERѾԼ׳ɵĹˣҵϷҲ⡣Ϸ⣬һһϷ˳棬ʼա

Ĵ»֣Ұ򻮷ֳɣ13+2ģ飨ʵǺ

2.2.3ṹͼ

ͼ2.1ͼ

ҪҪ󣬹滮ݺݵݽṹ

CݽṹϣڽCԳʱӦͳ滮ʹõı飬ָȣԼǵ͵ȡǺҪģڴڼѡ񲻺ʵı飬޸ľʮѡ

ڷһ̰ϷеԪأ̶óǶӦڳе

ߣ

ȣɫλá

ӦͣȡȻʾĻܴԻɽϴĵλԹ̶ȵÿ--ͣɫ--ͣ λ--XYꡣ

ӵ˶ķߵ

ӦͣЩΪİ벿жϷϵġֻĸҡ֮Ӧĸ3421ֻӦ01

ʳ   

ɫλá

Ӧͣɫɹ̶ģԲۡλáXYꡣ

ӵʳĴڡ

ӦͣΪ˱ظʳõģʳĺϵֵֻ01ûʳʳ

ԪأǽʾΪڵģԲûʲô˵ʵʵǽھֱɵı߿

Ҫı̼ļֵΪȫֱͣҪʹõѭԶͼ˵ֵַ飻ϷļǷ֣Ϸٶȣߵٶȣ

ͼ2.2ߵIJͣ˶Ĺؼ㷨ͼ

2.2.4ģĹܼ˵

Ҫģʵ˼·㷨ͼ˵

ؼڡ߲ͣƶSnakemove()

ߵIJͣƶߵһȡǰһڵλãڼоһڵλǰһڵλꡣУѶߵλΪͣһӦһڵλãi+1ڣ0iڣiڵȡi-1ڵ꣬i-1ڵȡi-2ڵꡭֱ1ȡ0ڵꡣ0ڵ꣬ͷҪij仯仯ΪÿڵijȡߵֻҪѭʹȥ  

2.2.5

гõ³ʼͼ

ͼ2.3ͼ

һСαʾߵһ壬ÿһڣһο飬ͷڱʾ

ͼ2.4ͼ

ûԼǽڣ߼ǰ

ͼ2.5ͼ

ϷʱʾGAME OVER

ͼ2.6ͼ

2.3Դ뼰ע

#define N 200

#include

#include

#include

#define LEFT 0x4b00

#define RIGHT 0x4d00

#define DOWN 0x5000

#define UP 0x4800

#define ESC 0x011b

int i,key;

int score=0;/*÷*/

int gamespeed=50000;/*ϷٶԼ*/

struct Food{

int x;/*ʳĺ*/

int y;/*ʳ*/

int yes;/*жǷҪʳı*/

}food;/*ʳĽṹ*/

struct Snake{

int x[N];

int y[N];

int node;/*ߵĽ*/

int direction;/*ƶ*/

int life;/* ߵ,0,1*/

}snake;

void Init(void);/*ͼ*/

void Close(void);/*ͼν*/

void DrawK(void);/*ʼ*/

void GameOver(void);/*Ϸ*/

void GamePlay(void);/*Ϸ*/

void PrScore(void);/*ɼ*/

/**/

void main(void){

Init();/*ͼ*/

DrawK();/*ʼ*/

GamePlay();/*Ϸ*/

Close();/*ͼν*/}

/*ͼ*/

void Init(void){

int gd=DETECT,gm;

registerbgidriver(EGAVGA_driver);

initgraph(&gd,&gm,"c:\\program files\\winyes\\tc20h\\bgi");

cleardevice();}

/*ʼ棬ϽΪ5040½Ϊ610460Χǽ*/

void DrawK(void){

/*setbkcolor(LIGHTGREEN);*/

setcolor(11);

setlinestyle(SOLID_LINE,0,THICK_WIDTH);/**/

for(i=50;i<=600;i+=10)/*Χǽ*/   {

rectangle(i,40,i+10,49); /*ϱ*/

rectangle(i,451,i+10,460);/*±*/   }

for(i=40;i<=450;i+=10)  {

rectangle(50,i,59,i+10); /**/

rectangle(601,i,610,i+10);/*ұ*/ }}

/*Ϸ*/

void GamePlay(void){

randomize();/**/

food.yes=1;/*1ʾҪʳ,0ʾѾʳ*/

snake.life=0;/**/

snake.direction=1;/**/

snake.x[0]=100;snake.y[0]=100;/*ͷ*/

snake.x[1]=110;snake.y[1]=100;

snake.node=2;/**/

PrScore();/*÷*/

while(1)/*ظϷ,ѹESC*/   {

while(!kbhit())/*ûа,Լƶ*/      {

if(food.yes==1)/*Ҫʳ*/     {

food.x=rand()%400+60;

food.y=rand()%350+60;

while(food.x%10!=0)/*ʳֺʳܹ,ſ߳Ե*/

food.x++;

while(food.y%10!=0)

food.y++;

food.yes=0;/*ʳ*/     }

if(food.yes==0)/*ʳ˾Ҫʾ*/     {

setcolor(GREEN);

rectangle(food.x,food.y,food.x+10,food.y-10);     }

for(i=snake.node-1;i>0;i--)/*ߵÿǰƶ,Ҳ̰ߵĹؼ㷨*/         {

snake.x[i]=snake.x[i-1];

snake.y[i]=snake.y[i-1];     }

/*1,2,3,4ʾ,,,ĸ,ͨжƶͷ*/

switch(snake.direction)     {

case 1:snake.x[0]+=10;break;

case 2: snake.x[0]-=10;break;

case 3: snake.y[0]-=10;break;

case 4: snake.y[0]+=10;break;     }

for(i=3;i

if(snake.x[i]==snake.x[0]&&snake.y[i]==snake.y[0])        {

GameOver();/*ʾʧ*/

snake.life=1;

break;        }        }

if(snake.x[0]<55||snake.x[0]>595||snake.y[0]<55||

snake.y[0]>455)/*Ƿײǽ*/    {

GameOver();/*Ϸ*/

snake.life=1; /**/    }

if(snake.life==1)/*жԺ,ѭ¿ʼ*/

break;

if(snake.x[0]==food.x&&snake.y[0]==food.y)/*ԵʳԺ*/    {

setcolor(0);/*ѻϵʳﶫȥ*/

rectangle(food.x,food.y,food.x+10,food.y-10);

snake.x[snake.node]=-20;snake.y[snake.node]=-20;

/*µһȷڿλ,´ѭȡǰһڵλ*/

snake.node++;/*ߵ峤һ*/

food.yes=1;/*Ҫµʳ*/

score+=10;

PrScore();/*µ÷*/    }

setcolor(4);/**/

for(i=0;i

rectangle(snake.x[i],snake.y[i],snake.x[i]+10,

snake.y[i]-10);

delay(gamespeed);

setcolor(0);/*úɫȥߵĵһ*/

rectangle(snake.x[snake.node-1],snake.y[snake.node-1],

snake.x[snake.node-1]+10,snake.y[snake.node-1]-10);     }  /*endwhilekbhit*/

if(snake.life==1)/*ѭ*/

break;

key=bioskey(0);/*հ*/

if(key==ESC)/*ESC˳*/

break;

else

if(key==UP&&snake.direction!=4)

/*жǷ෴ķƶ*/

snake.direction=3;

else

if(key==RIGHT&&snake.direction!=2)

snake.direction=1;

else

if(key==LEFT&&snake.direction!=1)

snake.direction=2;

else

if(key==DOWN&&snake.direction!=3)

snake.direction=4;

}/*endwhile(1)*/}

/*Ϸ*/

void GameOver(void){

cleardevice(); 

PrScore();

setcolor(RED);

settextstyle(0,0,4);

outtextxy(200,200,"GAME OVER");

getch();}

/*ɼ*/

void PrScore(void){   

char str[10];

setfillstyle(SOLID_FILL,YELLOW);

bar(50,15,220,35);

setcolor(6);

settextstyle(0,0,2);

sprintf(str,"score:%d",score);

outtextxy(55,20,str);}

/*ͼν*/

void Close(void){   

getch();

closegraph();

}

һα༭ʱ 2018-03-30
网站地图

银河1331官网