C语言仓库管理系统-数据结构 第3页

C语言仓库管理系统-数据结构 第3页
 do
   {printf("Please input the No.%d goods'%s:\n",n,string1);
    scanf("%ld",&ptr1->num);flushall();
    if(ptr1->num==0)
     {printf("Please press any key to back to last Menu:");
      getch( );
      free(ptr1);
      return(0);
      }
   printf("Please input the No.%d goods'%s:\n",n,string2);scanf("%s",&ptr1->name);
   flushall( );                           /*刷新缓冲区函数*/
   printf("Please input the No.%d goods'%s:\n",n,string3);scanf("%d",&ptr1->count);
   flushall( );
   if(CHECK_COUNT)
   printf("Please input the right goodscount!\n");
   }while(CHECK_COUNT);
  while(ptr1->num!=NULL)
  { if(n==1)
    head=ptr1;
   else ptr2->next=ptr1;
       ptr1->prior=ptr2;
   n=n+1;
   ptr2=ptr1;
   if((ptr1=(COM* )malloc(LEN))==NULL)
     { printf("No enough memory,fail to creat linklist!");
     getch( );
     }
   do
    {printf("Please input the No.%d goods'%s:\n",n,string1);
     scanf("%ld",&ptr1->num);
     flushall( );
     if(ptr1->num==0)
       {ptr1->num=NULL;
        break;}
     printf("Please input the No.%d goods'%s:\n",n,string2);scanf("%s",&ptr1->name);
     flushall( );
     printf("Please input the No.%d goods'%s:\n",n,string3);scanf("%d",&ptr1->count);
     flushall( );
     if(CHECK_COUNT)
     printf("Please input the right goodscount!\n");
    }while(CHECK_COUNT);
  }
  ptr2->next=NULL;
  gotoxy(1,24);
  printf("Finish the inputting of goods'message,press any key to back to last Menu,please save:");
  getch();
  return(head);
}
/*插入模块*/
COM * insert( )
 {COM * ptr3;
  char string1[ ]={"goodsnumber"};
  char string2[ ]={"goodsname"};
  char string3[ ]={"goodscount"};
  char judge[10];
  clrscr( );
  gotoxy(18,10);
  printf("Please input inserted goods'fliename:");
  head=openfile( );
  if(head==NULL)
  return(NULL);
  else
    do
     {clrscr( );
      printf("Please input inserted goods'goodsmessage:\n");
      if((ptr3=(COM*)malloc(LEN))==NULL)
      {printf("No enough memory,fail to creat node!");
       getch();
      }
    do
    {printf("Please input goods'%s(>0):\n",string1);scanf("%ld",&ptr3->num);
     flushall( );
     if(ptr3->num<=0)
       {printf("Error inputting!please choose the inserted goods again\n");
        getch( );return;
       }
    printf("Please input goods'%s:\n",string2);scanf("%s",&ptr3->name);flushall( );
    printf("Please input goods'%s:\n",string3);scanf("%d",&(ptr3->count)); flushall( );
    if(CHECK_COUNT2)
    printf("Please input the right goodscount(>0)!\n");
   }while(CHECK_COUNT2);
    ptr1=head;
    while(ptr1!=NULL)
    {ptr2=ptr1;
     ptr1=ptr1->next;
     ptr1->prior=ptr2;
    }
ptr2->next=ptr3;
ptr3->prior=ptr2;
    ptr3->next=NULL;
    printf("\nInserting success!Cotinue to insert?(yes or no):");
    scanf("%s",judge);
    clrscr( );
  }while(! strcmp(judge,"yes"));
 gotoxy(20,10);
 printf("Inserting 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);
}
/*删除模块*/
COM *delet( )
  {char name[10];
   char judge[10];
www.751com.cn
   gotoxy(20,10);
   printf("Please input delected goods'fliename:");
   head=openfile( );
   clrscr( );
   if(head==NULL)
     return(NULL);
   else
    do
     {do
       {clrscr( );
        gotoxy(3,4);
        printf("Please input delected goods'message:");
        gotoxy(1,9);
        printf("                        *1.Del depend on goodsnumber\n");
        gotoxy(1,10);

上一页  [1] [2] [3] [4] [5] [6] 下一页

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有