inquire_name.h 按名字查询函数
//////////////////////////////////////////////////
/*
查询指定名称
*/
void inquire_name(plink head)//输入参数为储存信息的链表头指针,想要查询的方式,想要查询的信息
{
plink p=head;
int option;
char mfts[20],supplier[20],customer[20],parts[20],models[20];
char int_mfts,int_supplier,int_customer,int_parts,int_models;
printf(" _________________________________________ \n");
printf(" | Inquire System |\n");
printf(" |_________________________________________|\n");
printf(" |Please choose the way you want to query : |\n");
printf(" | 1:mfts(Manufacturer) |\n");
printf(" | 2:Supplier |\n");
printf(" | 3:Customer |\n");
printf(" | 4:Parts name |\n");
printf(" | 5:models |\n");
printf(" | 6:Back to menu |\n");
printf(" | 7:Exit system |\n");
printf(" |_________________________________________|\n");
printf(" Your option:");
scanf("%d", &option);
switch(option){
case 1:
printf(" please input which manufacturer you want to search:");
scanf("%s",mfts);
int_mfts=switch_name_to_int(option,mfts);
printf(" _____________________________________________________________________________ \n");
printf(" |Time_|Part|Model|Mfts|Unit|Num|Total|Name|\n");
while(1)
{
if(p->mfts==int_mfts)
{
if(p->judge_delete==0)
{
print(p);
}
}
if(p->next==NULL)//链表读取结束则退出循环
break;p=p->next;}printf(" |_____________|__________|___________|__________|__________|_______|___________|__________|\n");break;case 2:printf(" please input which supplier you want to search:");scanf("%s",supplier);int_supplier=switch_name_to_int(option,supplier);while(1){if(p->name==int_supplier){if(p->judge_delete==0){print(p);}}if(p->next==NULL)//链表读取结束则退出循环{break;}p=p->next;}break;case 3:printf(" please input which customer you want to search:");scanf("%s",customer);int_customer=switch_name_to_int(option,customer);printf(" _________________________________________________________________________________________ \n");printf(" |____Time_____|___Part___|___Model___|___Mfts___|___Unit___|__Num__|___Total___|___Name___|\n");while(1){if(p->name==int_customer){if(p->judge_delete==0){print(p);}}if(p->next==NULL)//链表读取结束则退出循环break;p=p->next;}printf(" |_____________|__________|___________|__________|__________|_______|___________|__________|\n");break;case 4:printf(" please input which supplier you want to search:");scanf("%s",parts);int_parts=switch_name_to_int(option,parts);printf(" _________________________________________________________________________________________ \n");printf(" |____Time_____|___Part___|___Model___|___Mfts___|___Unit___|__Num__|___Total___|___Name___|\n");while(1){if(p->part==int_parts){if(p->judge_delete==0){print(p);}}if(p->next==NULL)//链表读取结束则退出循环break;p=p->next;}printf(" |_____________|__________|___________|__________|__________|_______|___________|__________|\n");break;case 5:printf(" please input which models you want to search:");scanf("%s",models);int_models=switch_name_to_int(option,models);printf(" _________________________________________________________________________________________ \n");printf(" |____Time_____|___Part___|___Model___|___Mfts___|___Unit___|__Num__|___Total___|___Name___|\n");while(1){if(p->model==int_models){if(p->judge_delete==0){print(p);}}if(p->next==NULL)//链表读取结束则退出循环break;p=p->next;}printf(" |_____________|__________|___________|__________|__________|_______|___________|__________|\n"); break; case 6: system("cls"); break; case 7: animate_exit(); }
}