int main()
{
for( ; ; )
{
switch(List_menu())
{
case 1:system("cls");
head=Create_List();
system("cls");
printf_List(head);
break;
case 2:system("cls");
p = (ListNode *)malloc(sizeof(ListNode));
printf("Please enter member information\n");
printf("Input ID: ");
scanf("%s",p->data.ID);
printf("Input Name: ");
scanf("%s",p->data.name);
printf("Input Occupation: ");
scanf("%s",p->data.OP);
ListNode_Insert(head,p);
system("cls");
printf_List(head);
break;
case 3:system("cls");
int xz;
printf("*********** Welcome to Find Function ***********\n");
printf("1.Find by ID: 2.Find by Name: \n");
printf("please input: ");
scanf("%d",&xz);
if(xz==1)
{
system("cls");
p = FindListNode_ID(head);
}
if(xz==2)
{
system("cls");
p = FindListNode_Name(head);
}
if(p!=NULL)
{
printf("****************************************\n");
printf("ID: %s",p->data.ID);
printf(" Name: %s",p->data.name);
printf(" Occupation: %s\n",p->data.OP);
printf("****************************************\n\n\n");
p=p->next;
}
else
printf("Not found\n");
break;
case 4: printf_List(head);
break;
case 5:system("cls");
printf("********************* Welcome to Delete Function ******************\n");
Delete_ListNode(head);
printf_List(head);
break;
case 6:exit(1);
break;
case 7: Destroy_List(head);
}//switch
}//for
}
菜单(menu)
int List_menu(void)
{
int sn;
printf("********************* information system **********************\n");
printf("**************** ****************\n");
printf("1.Input information 2.Insert information\n");
printf("3.Find Membership Information 4.Information List\n");
printf("5.Delete member information 6.Exit System\n");
printf("Input:1-6: ");
scanf("%d",&sn);
return sn;
}