程设小组作业——计算机配件的进货/销售管理系统

inquire_information_code.h 按识别代码查询信息函数

//////////////////////////////////////////////////
/*
按代码查询信息(修改系统)
3.29
*/
plink inquire_information_code(plink head,int code){
int count=0;
char part[20],model[20],mfts[20],name[20];
plink p=head;
while(1){
if(p->judge_delete!=1)
{
count++;
}
if(count==code)
{
break;
}
if(p->next==NULL)
{
break;
}
p=p->next;
}
if(count==code)
{
printf("\n The record you want to modify is as follow:\n");
printf(" ___________________________________________________________________________________ \n");
printf(" |No.|Time_|Part|Model|Mfts|Unit|Num|Total|Name|\n");
printf(" | %2d | %2d,",code,p->time.month);
if(p->time.day<=9)//统一格式(若数值小于10,则打印0X) printf("0"); printf("%d ",p->time.day);
if(p->time.hour<=9) printf("0"); printf("%d:",p->time.hour);
if(p->time.minute<=9) printf("0"); printf("%d ",p->time.minute);
switch_int_to_name(4,p->part,part);
switch_int_to_name(5,p->model,model);
switch_int_to_name(1,p->mfts,mfts);
switch_int_to_name(1,p->name,name);
printf("|%10s|%11s|%10s|%10.2f|%7d|%11.2f|%10s|\n",part,model,mfts,p->unit,p->num,p->total,name);
printf(" ||______|_|__|_|_|||__|\n");
}
else
{
printf("error:record not found!\n");
exit(1);
}
return p;
}

点赞

发表评论