C语言仓库管理系统-数据结构 第4页
printf(" *2.Del depend on goodsname\n");
gotoxy(10,22);
printf("please choose a number between 1 and 2:");
scanf("%d",&sel);
switch(sel)
{case 1:clrscr( );
gotoxy(6,6);
printf("Please input goodsnumber:");
scanf("%d",&del_num);
break;
case 2:clrscr( );
gotoxy(6,6);
printf("Please input goodsname:");
scanf("%s",&name);
break;
}
}while(sel!=1&&sel!=2);
ptr1=head;
if(ptr1->num==del_num||(strcmp(ptr1->name,name)==0))
{ head=ptr1->next;
printf("Success to delect goodsmessage!\n");
}
else /*判断是否是目标结点*/
{ while(ptr1!=NULL&&ptr1->num!=del_num&&strcmp(ptr1->name,name)!=0)
{ptr2=ptr1;
ptr1=ptr1->next;
ptr1->prior=ptr2;
}
if(ptr1->num==del_num||(strcmp(ptr1->name,name)==0))
{ptr2->next=ptr1->next;
ptr1->next->prior=ptr1->prior;
free(ptr1);
printf("\nSuccess to delect goodsmessage!\n\n");
}
else printf("\nCan't find this goodsmessage!\n\n");
}
printf("Cotinue to delect?(yes or no):");
scanf("%s",judge);
}while(!strcmp(judge,"yes"));
clrscr( );
gotoxy(20,10);
printf("Delecting success!\n");
gotoxy(18,11);
printf("Press any key to back to last Menu\n");
gotoxy(16,12);
printf("And make sure to Save(6) them or you will lose them!\n");
getch( );
return(head);
}
/*查找模块*/
void search( )
{char name[10];
char judge[10];
int sel;
long int sel_num;
clrscr( );
gotoxy(18,10);
printf("Please press searched goods'fliename:");
head=openfile( );
if(head==NULL)
return;
else
do
{do
{clrscr( );
gotoxy(5,4);
printf("Please choose the way to search:");
gotoxy(1,9);
printf(" *1.Search depend on goodsnumber\n");
printf(" *1.Search depend on goodsname\n");
gotoxy(10,22);
printf("please choose a number between 1 and 2:");
scanf("%d",&sel);
switch(sel)
{case 1:clrscr( );
printf("Please input goodsnumber:");
scanf("%ld",&sel_num);
break;
case 2:clrscr( );
printf("Please input goodsname:");
scanf("%s",name);
break;
}
}while(sel!=1&&sel!=2);
ptr1=head;
while(ptr1!=NULL&&ptr1->num!=sel_num&&strcmp(ptr1->name,name)!=0)
ptr1=ptr1->next;
if ((ptr1->num==sel_num)||(strcmp(ptr1->name,name)==0))
{printf("\n Success to search goodsmessage!\n");
printf("goodsnumber goodsname goodscount\n\n");
printf(PRINT);
}
else
printf("\nCan't find this goodsmessage!\n\n");
printf("Cotinue to search?(yes or no):");
scanf("%s",judge);
}while(!strcmp(judge,"yes"));
gotoxy(10,24);
printf("Please press any key to back to last Menu:");
getch( );
}
/*输出模块*/
void print( )
{int i=1;
clrscr( );
gotoxy(18,10);
printf("Please input printed goods'filename:");
head=openfile( );
if(head==NULL)
www.751com.cn follows:\n");
printf("goodsnumber goodsname goodscount\n\n");
ptr1=head;
do
{printf(PRINT);
ptr1=ptr1->next;
if(i/10==1) /*超过十行换页*/
www.751com.cn
clrscr( );
gotoxy(0,6);
printf("goodsnumber goodsname goodscount\n\n");
}
i=i+1;
}while(ptr1!=NULL);
gotoxy(10,24);
printf("Please press any key to back to last Menu:");
getch( );
}
上一页 [1] [2] [3] [4] [5] [6] 下一页