|
|
|
|
#include<stdio.h>
|
|
|
|
|
#include<stdlib.h>
|
|
|
|
|
#include<time.h>
|
|
|
|
|
#include<string.h>
|
|
|
|
|
#define OK 1
|
|
|
|
|
#define ERROR 0
|
|
|
|
|
#define NAME_INIT_MAXSIZE 20
|
|
|
|
|
#define CREDITS_INIT 100
|
|
|
|
|
#define LINK_MAXSIZE 1000
|
|
|
|
|
typedef int Status;
|
|
|
|
|
int NUM=1;
|
|
|
|
|
//<2F>˿<EFBFBD><CBBF><EFBFBD>Ϣ
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
int num;
|
|
|
|
|
int age,number;
|
|
|
|
|
int credits;
|
|
|
|
|
double discount;
|
|
|
|
|
char name[NAME_INIT_MAXSIZE];
|
|
|
|
|
}ElemType;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>洢
|
|
|
|
|
typedef struct LNode
|
|
|
|
|
{
|
|
|
|
|
ElemType information;
|
|
|
|
|
LNode *next;
|
|
|
|
|
}LNode,*LinkList;
|
|
|
|
|
Status AddInformation(LinkList &L,char Name[],int Age);
|
|
|
|
|
Status Init(LinkList &L);
|
|
|
|
|
Status Calculate_discount(LinkList &L);
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int LinkLength(LinkList L)
|
|
|
|
|
{
|
|
|
|
|
int l=0;
|
|
|
|
|
while(L->next!=NULL)
|
|
|
|
|
{
|
|
|
|
|
l++;
|
|
|
|
|
L=L->next;
|
|
|
|
|
}
|
|
|
|
|
return l;
|
|
|
|
|
}
|
|
|
|
|
//<2F><>ʼ<EFBFBD><CABC>
|
|
|
|
|
Status InitList(LinkList &L)
|
|
|
|
|
{
|
|
|
|
|
L=(LinkList)malloc(sizeof(LNode));
|
|
|
|
|
L->next=NULL;
|
|
|
|
|
L->information.credits=0;
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD>뵽<EFBFBD><EBB5BD>n<EFBFBD><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Status InsertNode(LinkList &L,int n,ElemType e)
|
|
|
|
|
{
|
|
|
|
|
if(n>LinkLength(L))
|
|
|
|
|
{
|
|
|
|
|
printf("Insert Error!\n");
|
|
|
|
|
return ERROR;
|
|
|
|
|
}
|
|
|
|
|
LinkList p =L;
|
|
|
|
|
int i=0;
|
|
|
|
|
while(p->next!=NULL && i<n)
|
|
|
|
|
{
|
|
|
|
|
i++;
|
|
|
|
|
p=p->next;
|
|
|
|
|
}
|
|
|
|
|
LinkList s=(LinkList)malloc(sizeof(LNode));
|
|
|
|
|
e.num=NUM++;
|
|
|
|
|
s->information=e;
|
|
|
|
|
s->next=p->next;
|
|
|
|
|
p->next=s;
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
//<><D7B7>
|
|
|
|
|
Status SupperaddNode(LinkList &L,ElemType e)
|
|
|
|
|
{
|
|
|
|
|
LinkList p=L,s=(LinkList)malloc(sizeof(LNode));
|
|
|
|
|
while(p->next!=NULL) p=p->next;
|
|
|
|
|
e.num=NUM++;
|
|
|
|
|
s->information=e;
|
|
|
|
|
s->next=NULL;
|
|
|
|
|
p->next=s;
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
|
|
|
|
Status PrintSingle(ElemType e)
|
|
|
|
|
{
|
|
|
|
|
printf("Name:%s\tAge:%d\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%d\t<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%.5d\t<EFBFBD>ۿ<EFBFBD>:%.2f\n",e.name,e.age,e.credits,e.number,e.discount);
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
//ɾ<><C9BE>
|
|
|
|
|
Status DeleteNode(LinkList &L,int n,ElemType &e)
|
|
|
|
|
{
|
|
|
|
|
if(n>LinkLength(L))
|
|
|
|
|
{
|
|
|
|
|
printf("Delete Error!\n");
|
|
|
|
|
return ERROR;
|
|
|
|
|
}
|
|
|
|
|
LinkList p=L;
|
|
|
|
|
int i=1;
|
|
|
|
|
while(p->next!=NULL && i!=n)
|
|
|
|
|
{
|
|
|
|
|
i++;
|
|
|
|
|
p=p->next;
|
|
|
|
|
}
|
|
|
|
|
LinkList s=p->next;
|
|
|
|
|
PrintSingle(s->information);
|
|
|
|
|
p->next=s->next;
|
|
|
|
|
free(s);
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD>ӳ<EFBFBD>ʼ<EFBFBD>û<EFBFBD>
|
|
|
|
|
Status AddInformation(LinkList &L,char Name[],int Age)
|
|
|
|
|
{
|
|
|
|
|
ElemType e;
|
|
|
|
|
strcpy(e.name,Name);
|
|
|
|
|
e.age=Age;
|
|
|
|
|
e.credits=CREDITS_INIT;
|
|
|
|
|
e.number=rand()%100000;
|
|
|
|
|
e.discount=1.0;
|
|
|
|
|
SupperaddNode(L,e);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Status PrintAll(LinkList L)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>пͻ<EFBFBD><EFBFBD><EFBFBD>Ϣ.\n");
|
|
|
|
|
printf("_____________________________________________________\n");
|
|
|
|
|
int i=0;
|
|
|
|
|
while(L->next!=NULL)
|
|
|
|
|
{
|
|
|
|
|
i++;
|
|
|
|
|
L=L->next;
|
|
|
|
|
PrintSingle(L->information);
|
|
|
|
|
}
|
|
|
|
|
printf("_____________________ <20><><EFBFBD><EFBFBD>%d<><64><EFBFBD>ͻ<EFBFBD> __________________\n",i);
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>_Name
|
|
|
|
|
Status FindNode_name(LinkList L)
|
|
|
|
|
{
|
|
|
|
|
printf("Input Name:");
|
|
|
|
|
char Name[NAME_INIT_MAXSIZE];
|
|
|
|
|
gets(Name);
|
|
|
|
|
bool flag=0;
|
|
|
|
|
while(L->next!=NULL)
|
|
|
|
|
{
|
|
|
|
|
L=L->next;
|
|
|
|
|
if(strcmp(L->information.name,Name)==0)
|
|
|
|
|
{
|
|
|
|
|
flag=1;
|
|
|
|
|
PrintSingle(L->information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!flag) printf("Not Find!\n");
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>_number
|
|
|
|
|
Status FindNode_number(LinkList L)
|
|
|
|
|
{
|
|
|
|
|
printf("Input Number:");
|
|
|
|
|
int Num;
|
|
|
|
|
bool flag=0;
|
|
|
|
|
scanf("%d",&Num);
|
|
|
|
|
while(L->next!=NULL)
|
|
|
|
|
{
|
|
|
|
|
L=L->next;
|
|
|
|
|
if(Num == L->information.number)
|
|
|
|
|
{
|
|
|
|
|
flag=1;
|
|
|
|
|
PrintSingle(L->information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!flag) printf("Not Find!\n");
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>_age
|
|
|
|
|
Status FindNode_age(LinkList L)
|
|
|
|
|
{
|
|
|
|
|
printf("Input Age:");
|
|
|
|
|
int Age;
|
|
|
|
|
bool flag=0;
|
|
|
|
|
scanf("%d",&Age);
|
|
|
|
|
while(L->next!=NULL)
|
|
|
|
|
{
|
|
|
|
|
L=L->next;
|
|
|
|
|
if(L->information.age==Age)
|
|
|
|
|
{
|
|
|
|
|
PrintSingle(L->information);
|
|
|
|
|
flag=1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!flag) printf("Not Find!\n");
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>_credits
|
|
|
|
|
Status FindNode_credits(LinkList L)
|
|
|
|
|
{
|
|
|
|
|
printf("Input Credits:");
|
|
|
|
|
int Credits;
|
|
|
|
|
scanf("%d",&Credits);
|
|
|
|
|
bool flag=0;
|
|
|
|
|
while(L->next!=NULL)
|
|
|
|
|
{
|
|
|
|
|
L=L->next;
|
|
|
|
|
if(Credits == L->information.credits)
|
|
|
|
|
{
|
|
|
|
|
flag=1;
|
|
|
|
|
PrintSingle(L->information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!flag) printf("Not Find!\n");
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
//ģ<><C4A3>_<EFBFBD><5F><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>=<3D><><EFBFBD><EFBFBD><EFBFBD>۸<EFBFBD>*2
|
|
|
|
|
Status Shopping(LinkList &Ll)
|
|
|
|
|
{
|
|
|
|
|
int length=LinkLength(Ll),range=100,i=0;
|
|
|
|
|
LinkList L=Ll;
|
|
|
|
|
printf("\t\t**** <20><><EFBFBD><EFBFBD>%d<><64><EFBFBD>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD> ****\n",length);
|
|
|
|
|
printf("<EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѷ<EFBFBD><EFBFBD><EFBFBD>Ϊ:");
|
|
|
|
|
scanf("%d",&range);
|
|
|
|
|
printf("<EFBFBD>˴ι<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ:\n\n");
|
|
|
|
|
printf("\t<EFBFBD><EFBFBD><EFBFBD>۹<EFBFBD><EFBFBD><EFBFBD>\t<EFBFBD>ۿۺ<EFBFBD><EFBFBD><EFBFBD>Ǯ\t<EFBFBD>ۿ<EFBFBD>\n");
|
|
|
|
|
while(L->next!=NULL && i++<=length)
|
|
|
|
|
{
|
|
|
|
|
L=L->next;
|
|
|
|
|
double sum=rand()%range;
|
|
|
|
|
double price=(1-L->information.discount)*sum;
|
|
|
|
|
printf("%d.\t%8.2f Ԫ\t%8.2f Ԫ\t%2.2f\n",i,sum,price,L->information.discount);
|
|
|
|
|
L->information.credits+=(int) price*2;
|
|
|
|
|
}
|
|
|
|
|
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> !\n<EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۿ<EFBFBD>...\n");
|
|
|
|
|
Calculate_discount(Ll);
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
/*<2A><><EFBFBD><EFBFBD><EFBFBD>ۿ<EFBFBD>
|
|
|
|
|
(0) 100-200 1%
|
|
|
|
|
(1) 200-500 2%
|
|
|
|
|
(2) 500-1000 6%
|
|
|
|
|
(3) 100-2000 9%
|
|
|
|
|
(4) 2000-5000 12%
|
|
|
|
|
(5) 5000-9000 15%
|
|
|
|
|
(6) 9000-36000 18%
|
|
|
|
|
(7) >36000 24%
|
|
|
|
|
*/
|
|
|
|
|
Status Calculate_discount(LinkList &L)
|
|
|
|
|
{
|
|
|
|
|
LinkList p=L;
|
|
|
|
|
while(p->next!=NULL)
|
|
|
|
|
{
|
|
|
|
|
p=p->next;
|
|
|
|
|
int cd=p->information.credits;
|
|
|
|
|
if(100<=cd && cd<200) p->information.discount=0.01;
|
|
|
|
|
else if(200<=cd && cd<500) p->information.discount=0.02;
|
|
|
|
|
else if(cd<1000) p->information.discount=0.06;
|
|
|
|
|
else if(cd<2000) p->information.discount=0.09;
|
|
|
|
|
else if(cd<4000) p->information.discount=0.12;
|
|
|
|
|
else if(cd<6000) p->information.discount=0.15;
|
|
|
|
|
else if(cd<360000) p->information.discount=0.18;
|
|
|
|
|
else p->information.discount=0.24;
|
|
|
|
|
}
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD>Ҳ˵<D2B2>
|
|
|
|
|
int Find_menu()
|
|
|
|
|
{
|
|
|
|
|
printf("\t <20><><EFBFBD><EFBFBD> \n");
|
|
|
|
|
printf("\t___________________________\n");
|
|
|
|
|
printf("\t 1.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \n");
|
|
|
|
|
printf("\t___________________________\n");
|
|
|
|
|
printf("\t 2.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \n");
|
|
|
|
|
printf("\t___________________________\n");
|
|
|
|
|
printf("\t 3.<2E><><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD> \n");
|
|
|
|
|
printf("\t___________________________\n");
|
|
|
|
|
printf("\t 4.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \n");
|
|
|
|
|
printf("\t___________________________\n");
|
|
|
|
|
printf("\t 5.<2E><><EFBFBD><EFBFBD> \n");
|
|
|
|
|
printf("\t___________________________\n");
|
|
|
|
|
printf("--------<2D><>ѡ<EFBFBD><D1A1>:");
|
|
|
|
|
char c[5];
|
|
|
|
|
scanf("%s",c);
|
|
|
|
|
getchar();
|
|
|
|
|
return atoi(c);
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
Status Find(LinkList L)
|
|
|
|
|
{
|
|
|
|
|
switch(Find_menu())
|
|
|
|
|
{
|
|
|
|
|
case 1:FindNode_name(L);break;
|
|
|
|
|
case 2:FindNode_age(L);break;
|
|
|
|
|
case 3:FindNode_number(L);break;
|
|
|
|
|
case 4:FindNode_credits(L);break;
|
|
|
|
|
case 5:break;
|
|
|
|
|
default:printf("Input Error!\n");break;
|
|
|
|
|
}
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD>Ӳ˵<D3B2>
|
|
|
|
|
int Add_menu()
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t_______ <20><><EFBFBD><EFBFBD> _______\n\n");
|
|
|
|
|
printf("\t\t 1.<2E><><EFBFBD><EFBFBD><EFBFBD><D7B7>. \n\n");
|
|
|
|
|
printf("\t\t 2.ֱ<>Ӳ<EFBFBD><D3B2><EFBFBD>. \n\n");
|
|
|
|
|
printf("\t\t 3.<2E><><EFBFBD><EFBFBD>. \n\n");
|
|
|
|
|
printf("\t\t____________________\n");
|
|
|
|
|
printf("------<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
char s[5];
|
|
|
|
|
scanf("%s",s);
|
|
|
|
|
getchar();
|
|
|
|
|
return atoi(s);
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
Status Add(LinkList &L)
|
|
|
|
|
{
|
|
|
|
|
int select=Add_menu();
|
|
|
|
|
if(select==3) return OK;
|
|
|
|
|
if(select!=1 && select!=2)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!\n");
|
|
|
|
|
return ERROR;
|
|
|
|
|
}
|
|
|
|
|
ElemType e;
|
|
|
|
|
char Name[NAME_INIT_MAXSIZE];
|
|
|
|
|
int Age;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
printf("Input Name:");
|
|
|
|
|
gets(Name);
|
|
|
|
|
// getchar();
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
printf("Input Age:");
|
|
|
|
|
scanf("%d",&Age);
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
strcpy(e.name,Name);
|
|
|
|
|
e.age=Age;
|
|
|
|
|
e.credits=CREDITS_INIT;
|
|
|
|
|
e.number=rand()%1000000;
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7B7>
|
|
|
|
|
if(select==1) SupperaddNode(L,e);
|
|
|
|
|
else if(select==2)
|
|
|
|
|
{
|
|
|
|
|
int p;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&p);
|
|
|
|
|
InsertNode(L,p,e);
|
|
|
|
|
}
|
|
|
|
|
Calculate_discount(L);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD>!\n");
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
//<2F>Ŀͻ<C4BF><CDBB><EFBFBD>Ϣ
|
|
|
|
|
Status AlterInformation(LinkList &L)
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
int num;
|
|
|
|
|
bool flag=0;
|
|
|
|
|
LinkList p=L;
|
|
|
|
|
scanf("%d",&num);
|
|
|
|
|
getchar();
|
|
|
|
|
while(p->next!=NULL)
|
|
|
|
|
{
|
|
|
|
|
p=p->next;
|
|
|
|
|
if(p->information.number == num)
|
|
|
|
|
{
|
|
|
|
|
flag=1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!flag) printf("Not Find!\n");
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
PrintSingle(p->information);
|
|
|
|
|
char Name[NAME_INIT_MAXSIZE];
|
|
|
|
|
int Age;
|
|
|
|
|
printf("Name:");
|
|
|
|
|
gets(Name);
|
|
|
|
|
printf("Age:");
|
|
|
|
|
scanf("%d",&Age);
|
|
|
|
|
getchar();
|
|
|
|
|
num=rand()%1000000;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD><EFBFBD><EFBFBD>Ϊ:%.6d\n",num);
|
|
|
|
|
char c;
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD>ȷ<EFBFBD><EFBFBD> y/n :");
|
|
|
|
|
scanf("%c",&c);
|
|
|
|
|
if(c!='y' && c!='Y')
|
|
|
|
|
{
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>!\n");
|
|
|
|
|
return ERROR;
|
|
|
|
|
}
|
|
|
|
|
p->information.age=Age;
|
|
|
|
|
strcpy(p->information.name,Name);
|
|
|
|
|
p->information.number=num;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!\n");
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
//ɾ<><C9BE>
|
|
|
|
|
Status Delete(LinkList &L)
|
|
|
|
|
{
|
|
|
|
|
int num;
|
|
|
|
|
ElemType e;
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
scanf("%d",&num);
|
|
|
|
|
LinkList p =L;
|
|
|
|
|
DeleteNode(L,num,e);
|
|
|
|
|
printf("<EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>!\n");
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD>˵<EFBFBD>
|
|
|
|
|
int Main_menu()
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t\t\t <20><><EFBFBD>˵<EFBFBD> \n");
|
|
|
|
|
printf("\t\t\t_____________________________\n");
|
|
|
|
|
printf("\t\t\t 1.ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> \n");
|
|
|
|
|
printf("\t\t\t_____________________________\n");
|
|
|
|
|
printf("\t\t\t 2.<2E><>ʾ<EFBFBD><CABE><EFBFBD>пͻ<D0BF><CDBB><EFBFBD>Ϣ. \n");
|
|
|
|
|
printf("\t\t\t_____________________________\n");
|
|
|
|
|
printf("\t\t\t 3.<2E><><EFBFBD>ҿͻ<D2BF>. \n");
|
|
|
|
|
printf("\t\t\t_____________________________\n");
|
|
|
|
|
printf("\t\t\t 4.<2E><><EFBFBD>ӿͻ<D3BF>. \n");
|
|
|
|
|
printf("\t\t\t_____________________________\n");
|
|
|
|
|
printf("\t\t\t 5.<2E>Ŀͻ<C4BF><CDBB><EFBFBD>Ϣ. \n");
|
|
|
|
|
printf("\t\t\t_____________________________\n");
|
|
|
|
|
printf("\t\t\t 6.ɾ<><C9BE><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>¼. \n");
|
|
|
|
|
printf("\t\t\t_____________________________\n");
|
|
|
|
|
printf("\t\t\t 7.<2E>˳<EFBFBD>. \n");
|
|
|
|
|
printf("\t\t\t_____________________________\n");
|
|
|
|
|
printf("--------<2D><>ѡ<EFBFBD><D1A1>:");
|
|
|
|
|
char chio[4];
|
|
|
|
|
scanf("%s",chio);
|
|
|
|
|
return atoi(chio);
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int main()
|
|
|
|
|
{
|
|
|
|
|
LinkList L;
|
|
|
|
|
Init(L);
|
|
|
|
|
while(true)
|
|
|
|
|
{
|
|
|
|
|
switch(Main_menu())
|
|
|
|
|
{
|
|
|
|
|
case 1:Shopping(L);break;
|
|
|
|
|
case 2:PrintAll(L);break;
|
|
|
|
|
case 3:Find(L);break;
|
|
|
|
|
case 4:Add(L);break;
|
|
|
|
|
case 5:AlterInformation(L);break;
|
|
|
|
|
case 6:Delete(L);break;
|
|
|
|
|
case 7:printf("ллʹ<EFBFBD><EFBFBD>,<2C>ټ<EFBFBD>!\n");return 0;
|
|
|
|
|
default:printf("Error!\n");
|
|
|
|
|
}
|
|
|
|
|
system("pause");
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
Status Init(LinkList &L)
|
|
|
|
|
{
|
|
|
|
|
printf("\t\t******** <20><>ӭ<EFBFBD><D3AD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>ѻ<EFBFBD><D1BB>ֹ<EFBFBD><D6B9><EFBFBD>ϵͳ ********\n");
|
|
|
|
|
srand(time(0));
|
|
|
|
|
InitList(L);
|
|
|
|
|
AddInformation(L,"Elen",19);
|
|
|
|
|
AddInformation(L,"Amy",21);
|
|
|
|
|
AddInformation(L,"Sunny",19);
|
|
|
|
|
AddInformation(L,"Jeniffer",20);
|
|
|
|
|
AddInformation(L,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>",6);
|
|
|
|
|
AddInformation(L,"<EFBFBD><EFBFBD>ͷǿ",12);
|
|
|
|
|
AddInformation(L,"Ь<EFBFBD><EFBFBD>",99);
|
|
|
|
|
Calculate_discount(L);
|
|
|
|
|
// PrintAll(L);
|
|
|
|
|
return OK;
|
|
|
|
|
}
|
|
|
|
|
|