| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2019 人关注过本帖
标题:[急求]商品货架管理
只看楼主 加入收藏
wxmkiller
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-12-27
收藏
 问题点数:0 回复次数:3 
[急求]商品货架管理
商品货架的原理是什么?有没有源程序啊~~请高手上来帮小弟一把
搜索更多相关主题的帖子: 货架 商品 管理 
2007-12-28 21:37
探拓者
Rank: 1
等 级:新手上路
帖 子:62
专家分:0
注 册:2005-10-13
收藏
得分:0 
期待中
期待中

2007-12-29 20:09
suzh1987
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-12-30
收藏
得分:0 
本人自己写的,用的是C语言,希望对你有用,我只是个学生,水平有限,仅供参考
#include<string.h>
 #include<ctype.h>
 #include<malloc.h> /* malloc()等 */
 #include<limits.h> /* INT_MAX等 */
 #include<stdio.h> /* EOF(=^Z或F6),NULL */
 #include<stdlib.h> /* atoi() */
 #include<io.h> /* eof() */
 #include<math.h> /* floor(),ceil(),abs() */
 #include<process.h> /* exit() */
 struct   cangku                              /*仓库结构体*/
{
    int amount;
    char number[6];
    cangku *next;
};

struct goodsinformation                     /*商品信息结构体*/
{
    char name[6];
    char number[6];
    float discount;
    float price;
    struct goodsinformation *next;
};

struct zhangben                              /*账本数据结构*/
{
    char number[6];
    int  amount;
    char  date[6];
    int  buyorsell;
    struct zhangben *next;
};

typedef struct zhangben           *pzhangben;
typedef struct goodsinformation   *pgoodsinformation;
typedef struct cangku             *pcangku;


/*信息表的插入*/
void Goodsinis(struct goodsinformation *Qg)
{
    int judge=1;
    int i=0;
    struct goodsinformation *s;
    pgoodsinformation pg;
    pgoodsinformation GPmove(pgoodsinformation Qg,char number[6]);
    s=(goodsinformation *)malloc(sizeof(goodsinformation));
    
    if((*Qg).next)
    {
        (*s).next=(*Qg).next;
        (*Qg).next=s;
    }
    else
    {
        (*Qg).next=s;
        (*s).next=NULL;
    }

    judge=1;
    while(judge)
    {
        printf("请输入欲进货的编号,要求必须是五位数!");
        scanf("%s",&((*s).number));
        while(i<6)
        {
            if((!(((*s).number[i]-'0')>=0)&&(((*s).number[i]-'0')<=9))&&(i<5))
            {
                printf("您输入的编码有误,请重新输入\n");
                judge=1;
                break;
            }
            if(((*s).number[i]!='\0')&&(i==5))
            {
                judge=1;
                printf("您输入的编码有误,请重新输入\n");
                break;
            }
            i++;
            judge=0;
        }
        pg=GPmove(s,(*s).number);

    
        if(pg!=NULL)
        {
            printf("您输入的编号重复\n");
            judge=1;
        }
    }

    judge=1;
    while(judge)
    {
        printf("请输入商品的品名\n");
        scanf("%s",&((*s).name));
        if(((*s).name[0]=='\0')||((*s).name[1]=='\0')||((*s).name[2]=='\0')||((*s).name[3]=='\0')||((*s).name[4]=='\0')||((*s).name[5]=='\0'))
        {
            judge=0;
        }
        else
        {
            printf("产品名字太长,搞简练点,做多五个字母\n\n\n");
        }
    }
    
    printf("请输入商品的价格\n");
    scanf("%f",&((*s).price));
    judge=1;
    while(judge)
    {
        printf("请输入商品的折扣,  0到1之间\n");
        scanf("%f",&((*s).discount));
    
        if(!(((*s).discount>0)&&((*s).discount<=1)))
        {    
        
            if((*s).discount>1)
            {
                printf("牛逼了啊!你还想打几折了?重新输入!\n\n");
            }
            else
            {    
                printf("倒贴钱你也敢卖东西?捐给希望工程算了,重新输入!!!\n\n");
            }
            
        }
        else
        {
            judge=0;
        }
    }
    printf("\n");
}


/*信息表的删除操作*/
void Gooddelet(struct goodsinformation *Qg,char number[6])
{
    int judge=1;
    struct goodsinformation *i,*p;
    i=(*Qg).next;
    p=Qg;
    while(strcmp(number,(*i).number)!=0)
    {
        if((*i).next)
        {
            i=(*i).next;
            p=(*p).next;
        }
        else
        {
            judge=0;
            break;
        }
    }
    if(judge==1)
    {
        (*p).next=(*i).next;
        free(i);
    }
    else
    {
        printf("您的输入有误");
    }
}

/*仓库出入库函数*/
void Cangkuget(cangku *Qc,char number[6],int amount,int buyorsell)
{
    int n,judge=1;
    cangku *i,*p,*s;
    
    if((*Qc).next==NULL)
    {
        s=(cangku *)malloc(sizeof(cangku));
            strcpy((*s).number,number);
            (*s).amount=amount;
            (*s).next=(*Qc).next;
            (*Qc).next=s;
    }
    else
    {
        i=(*Qc).next;
        p=Qc;
        if(buyorsell==0)
        {
           amount=amount-2*amount;
        }
    

         while(strcmp(number,(*i).number))
        {
             if((*i).next)
             {
                i=(*i).next;
                p=(*p).next;
             }
           else
           {
              
                judge=0;
                break;
            }
         }
         if((judge==0)/*&&(amount>0)*/)
         {
                s=(cangku *)malloc(sizeof(cangku));
                strcpy((*s).number,number);
                (*s).amount=amount;
                (*s).next=(*Qc).next;
                (*Qc).next=s;
         }
         else
         {
            n=amount+(*i).amount;


            if(n>0)
            {
                (*i).amount=n;
            }
            else if(n==0)
            {
                (*p).next=(*i).next;
                free(i);
            }
            else
            {
                printf("库存不足\n\n");
            }
         }
    }
    if(amount<0)
        amount=(-1)*amount;
}

/*账本写入函数*/
void Wzhangben(struct zhangben *Qz,char number[6],int amount,int buyorsell,char date[6])
{
    zhangben *i,*p;
    i=Qz;

    while((*i).next)
    {
        i=(*i).next;
    }
    p=(zhangben *)malloc(sizeof(zhangben));
    (*i).next=p;
    (*p).next=NULL;
    i=(*i).next;
    strcpy((*i).date,date);
    strcpy((*i).number,number);
    (*i).amount=amount;
    (*i).buyorsell=buyorsell;

}
/*仓库表按编号查询函数*/
pcangku CPmove(pcangku Qc,char number[6])
{
 
    int n,i;
    char number2[6];
    pcangku p;
    p=(*Qc).next;
    while(p!=0)
    {
        
        for(i=0;i<=5;i++)
        {
            number2[i]=(*p).number[i];
        }
        n=strcmp(number2,number);
    
        if(n==0)
            break;
        p=(*p).next;
    }

    return(p);
}
/*产品信息表按编号查询函数*/
struct goodsinformation *GPmove(pgoodsinformation Qg,char number[6])
{
    int n,i;
    char number2[6];
    goodsinformation *p;
    p=(*Qg).next;
    
    while(p!=0)
    {
        
        for(i=0;i<=5;i++)
        {
            number2[i]=(*p).number[i];
        }
        n=strcmp(number2,number);
    
        if(n==0)
            break;
        p=(*p).next;
    }
//    printf("%d",p);

    return(p);
}
/*进货函数*/
void Gget(cangku *Qc,goodsinformation *Qg,zhangben *Qz)
{
    char number[6];
    char date[6];
    int buyorsell=1;
    int i=0;
    int judge=1;
    int amount=0;
    pgoodsinformation pg;
    
     while(judge)
    {
        printf("请输入欲进货的编号,要求必须是五位数!");
        scanf("%s",number);
        
        while(i<6)
        {
            if((!(number[i]-'0'>=0)&&(number[i]-'0'<=9))&&(i<5))
            {
                printf("您输入的编码有误,请重新输入\n");
                judge=1;
                break;
            }
            if((number[i]!='\0')&&(i==5))
            {
                judge=1;
                printf("您输入的编码有误,请重新输入\n");
                break;
            }
            i++;
            judge=0;
        }
    }

    pg=GPmove(Qg,number);
//    printf("%d",pg);
    
    
    
    if(pg==NULL)
    {
        printf("本店从未进过此类商品,请输入商品信息\n");
        Goodsinis(Qg);
        printf("请输入商品进货的数量");
        scanf("%d",&amount);
        Cangkuget(Qc,(*Qg).next->number,amount,buyorsell);
    }
    else
    {
        printf("请输入商品进货的数量");
        scanf("%d",&amount);
        Cangkuget(Qc,number,amount,buyorsell);
    }
    
   
    judge=1;
    while(judge)
    {
        printf("请输入商品卖出的时间按照年月日的顺序,如60721表示2006年7月21日(共五位数)");
        scanf("%s",date);
        if(!((date[0]-'0')>=0&&(date[0]-'0')<=9))
        {
            printf("您的输入有误,请重新输入!\n\n\n\n\n");
            continue;
        }
        if((date[1]-'0')==0)
        {
            if(!((date[2]-'0')>=0&&(date[2]-'0')<=9))
            {
            
                printf("您的输入有误,请重新输入!\n\n\n\n\n");
            
                continue;
        
            }
        }
        else if((date[1]-'0')==1)
        {
            if(!((date[2]-'0')>=0&&(date[2]-'0')<=2))
            {
                printf("您的输入有误,请重新输入!\n\n\n\n\n");
                continue;
            }
        }
        else
        {
            printf("您的输入有误,请重新输入!\n\n\n\n\n");
                continue;
        }
        if(!(((date[3]-'0')>=0)&&((date[3]-'0')<=3)))
        {
            printf("您的输入有误,请重新输入!\n\n\n\n\n");
            continue;
        }
        if(!((date[4]-'0')>=0&&(date[4]-'0')<=9))
        {
            printf("您的输入有误,请重新输入!\n\n\n\n\n");
            continue;
        }
        if(date[3]-'0'==3)
        {
            if(!((date[4]-'0'==0)||(date[4]-'0'<=1)))
            {
                printf("您的输入有误,请重新输入!\n\n\n\n\n");
                continue;
            }
        }
        if(date[5]!='\0')
        {
            printf("您的输入有误,请重新输入!\n\n\n\n\n");
            continue;
        }
        judge=0;
    }
    
    
    Wzhangben(Qz,number,amount,buyorsell,date);
}

/*零售函数*/
void Sell(cangku *Qc,goodsinformation *Qg,zhangben *Qz)
{
    char number[6];
    char date[6];
    int buyorsell=0;
    int i=0;
    int judge=1;
    int before,last,amount=0;
    pgoodsinformation pg;
    cangku *zhizhen;


    while(judge)
    {
        printf("请输入欲卖的编号,要求必须是五位数!");
        scanf("%s",number);
        
        while(i<6)
        {
            if((!(number[i]-'0'>=0)&&(number[i]-'0'<=9))&&(i<5))
            {
                printf("您输入的编码有误,请重新输入\n");
                judge=1;
                break;
            }
            if((number[i]!='\0')&&(i==5))
            {
                judge=1;
                printf("您输入的编码有误,请重新输入\n");
                break;
            }
            i++;
            judge=0;
        }
    }
    

        pg=GPmove(Qg,number);
        zhizhen=CPmove(Qc,number);
        if((pg==NULL)||(zhizhen==NULL))
        {
            printf("没有此类商品信息或者早已没有库存\n\n");
        }
        else
        {

        printf("请输入想要卖出的数量\n\n");
        scanf("%d",&amount);
        zhizhen=CPmove(Qc,number);
        before=(*zhizhen).amount;
    
        Cangkuget(Qc,number,amount,buyorsell);
        last=(*zhizhen).amount;
        if(before!=last)
        {
        

    judge=1;
    while(judge)
    {
        printf("请输入商品卖出的时间按照年月日的顺序,如60721表示2006年7月21日(共五位数)");
        scanf("%s",date);
        if(!((date[0]-'0')>=0&&(date[0]-'0')<=9))
        {
            printf("您的输入有误,请重新输入!\n\n\n\n\n");
            continue;
        }
        if((date[1]-'0')==0)
        {
            if(!((date[2]-'0')>=0&&(date[2]-'0')<=9))
            {
            
                printf("您的输入有误,请重新输入!\n\n\n\n\n");
            
                continue;
        
            }
        }
        else if((date[1]-'0')==1)
        {
            if(!((date[2]-'0')>=0&&(date[2]-'0')<=2))
            {
                printf("您的输入有误,请重新输入!\n\n\n\n\n");
                continue;
            }
        }
        else
        {
            printf("您的输入有误,请重新输入!\n\n\n\n\n");
            continue;
        }
        if(!((date[3]-'0')>=0&&(date[3]-'0')<=3))
        {
            printf("您的输入有误,请重新输入!\n\n\n\n\n");
            continue;
        }
        if(!((date[4]-'0')>=0&&(date[4]-'0')<=9))
        {
            printf("您的输入有误,请重新输入!\n\n\n\n\n");
            continue;
        }
        if((date[3]-'0')==3)
        {
            if((((date[4]-'0')>=0)&&((date[4]-'0')<=1)))
            printf("您的输入有误,请重新输入!\n\n\n\n\n");
            continue;
        }
        if(date[5]!='\0')
        {
            printf("您的输入有误,请重新输入!\n\n\n\n\n");
            continue;
        }
        judge=0;
        }
        Wzhangben(Qz,number,amount, buyorsell,date);
        }
        else
        {
        }
        }

    }


/*仓库信息输出函数*/
void pcangku_print(cangku *Qc)
 {
     pcangku p;
     p=(*Qc).next;
     if((*Qc).next)
     {
         while(p)
        {
            printf("商品编码为%s\n",(*p).number);                    /*输出商品编码*/
            {
                if((*p).amount==NULL)
                    printf("库存为0");
                else
                    printf("商品数量为%d\n",(*p).amount);
            }                                                            /*输出商品数量*/
            p=p->next;
            printf("\n\n\n\n\n");
        
        }
     }
     else  printf("仓库中没有任何商品\n");
     printf("\n\n\n\n\n");
 }
 

/*信息表信息输出函数*/
void pgoodsinformation_print(goodsinformation *Qg)
 {
     goodsinformation *p;
     p=(*Qg).next;
    
     if((*Qg).next)
     {
         while(p)
            {
                printf("商品编码为%s\n",(*p).number);                        /*输出商品编码*/
                printf("商品名称为%s\n",(*p).name);                          /*输出商品名称*/
                printf("商品折扣为%f\n",(*p).discount);                      /*输出商品折扣*/
                printf("商品价格为%f\n",(*p).price);                         /*输出商品价格*/           
                p=p->next;  
                printf("\n\n\n\n\n");
                
            }
     }
     else  printf("没有任何商品信息\n");
     printf("\n\n\n\n\n");
 }


/*账本信息输出函数*/
void pzhangben_print(zhangben *Qz,goodsinformation *Qg)
 {
    float i,QQ;
    goodsinformation *q;
     zhangben *p;
     p=(*Qz).next;
     if((*Qz).next)
     {    
    
        
         while(p)
        {
             q=GPmove(Qg,(*p).number);
             printf("商品编码为%s\n",(*q).number);              /*输出商品编码*/
             {
                if((*p).buyorsell==1)
                    printf("购入");
                else  printf("卖出");
             }                                                      /*买入或卖出*/
            
             {
                 if((*p).amount==NULL)
                    printf("库存为0");
                else
                    printf("的商品数量为%d\n",(*p).amount);
             }                                                    /*输出商品数量*/
            
        

             i=((*q).price)*((*q).discount)*((*p).amount);
             printf("此次交易的总额为\n%f",i);
             printf("交易日期为%s\n",(*p).date);                /*输出商品日期*/
             p=p->next;
             printf("\n\n\n\n\n");
         }
          
     }
     else  printf("没有任何出入帐记录\n");
     printf("\n\n\n\n\n");
 }
 

/*按编码输出商品信息*/
void shangpinxinxi_print(pgoodsinformation Qg,pcangku Qc,char number[6])
{
    cangku *i;
    goodsinformation *j;
    i=CPmove(Qc,number);
    j=GPmove(Qg,number);
    if(j==NULL)
    {
        printf("从未进过此类商品");
    }
    else if(i==NULL)
    {
            printf("商品名称为%s\n",(*j).name);                  /*输出商品名称*/
            printf("商品编码为%s\n",(*j).number);                /*输出商品编码*/
            printf("商品价格为%f\n",(*j).price);                 /*输出商品价格*/
            printf("商品折扣为%f\n",(*j).discount);              /*输出商品折扣*/
            printf("仓库中已经没有存货");

    }
    else
    {
        if((*Qc).next!=NULL)
        {
            printf("商品名称为%s\n",(*j).name);                  /*输出商品名称*/
            printf("商品编码为%s\n",(*i).number);                /*输出商品编码*/
            printf("商品价格为%f\n",(*j).price);                 /*输出商品价格*/
            printf("商品折扣为%f\n",(*j).discount);              /*输出商品折扣*/
            printf("商品数量为%d\n",(*i).amount);                  /*输出商品数量*/
        }
        else  if(((*Qc).next==NULL)&&((*Qg).next!=NULL))
        {
            printf("商品名称为%s\n",(*j).name);                  /*输出商品名称*/
            printf("商品编码为%s\n",(*j).number);                /*输出商品编码*/
            printf("商品价格为%f\n",(*j).price);                 /*输出商品价格*/
            printf("商品折扣为%f\n",(*j).discount);              /*输出商品折扣*/
            printf("库存为0");                                       /*输出商品数量*/
        }
        else  if((*Qg).next==NULL)
        printf("在商品信息表和仓库中都没有任何商品信息\n");
    
            
    }
        printf("\n\n\n\n\n");
    
}
   


/*按编码输出买卖记录函数*/
void zhangbenjilu_print(zhangben *Qz,goodsinformation *Qg,char number[6])
{
    zhangben *p;
    goodsinformation *q;
    float i;
    p=(*Qz).next;
    q=GPmove(Qg,number);
    if(p)
    {
        while(p&&q)
        {
            if(!strcmp((*p).number,number))
            {
                i=((*q).price)*((*q).discount)*((*p).amount);
                printf("商品编码%s\n",(*p).number);                  /*输出商品编码*/
                printf("商品价格为%f\n",(*q).price);                 /*输出商品价格*/
                printf("商品数量为%d\n",(*p).amount);                /*输出商品数量*/
                if((*p).buyorsell==1)
                {
                    printf("买入的日期为%s\n",(*p).date);            /*输出商品买入日期*/
                    printf("买入商品总额为%f\n",i);                  /*买入商品总额*/
                }
                else  
                {
                    printf("商品折扣为%f\n",(*q).discount);           /*输出商品折扣*/
                    printf("卖出的日期为%s\n",(*p).date);             /*输出商品卖出日期*/
                    printf("卖出商品总额为%f\n",i);                   /*卖出商品总额*/
                }
            }
            
            p=p->next;
        
            printf("\n\n\n\n\n");
        }
        
    }
    else  printf("此种商品没有任何销售记录\n");
}

void modify(goodsinformation *Qg,zhangben *Qz,cangku *Qc)
{    

    float price,discount;
    int R=1;
    int i=0,
    int judge=1;
    char yesorno,c,number[6];
    char number2[6];
    char name[6];
    pgoodsinformation gp;
    pcangku cp;
    pzhangben zp;

    cp=Qc;
    zp=Qz;

    printf("请输入您要修改的商品编号\n");
    scanf("%s",number);
    gp=GPmove(Qg,number);
    if(gp!=NULL)
    {

        while(R)
        {
        printf("请问您要修改商品的哪些信息\n1为编号\n2为折扣\n3为价格\n4为名称\n");
        scanf("%s",&c);
        switch(c)
        {
            case '1':
                judge=1;
                while(judge)
                {
                        printf("请输入新的产品编号,要求必须是五位数!");
                        scanf("%s",number2);
                        while(i<6)
                        {
                            if((!((number2[i]-'0')>=0)&&((number2[i]-'0')<=9))&&(i<5))
                            {
                                printf("您输入的编码有误,请重新输入\n");
                                judge=1;
                                break;
                            }
                            if((number2[i]!='\0')&&(i==5))
                            {
                                judge=1;
                                printf("您输入的编码有误,请重新输入\n");
                                break;
                            }
                            i++;
                            judge=0;
                        }
                        gp=GPmove(Qg,number2);
        //                printf("%d",gp);
        
    
                        if(gp!=NULL)
                        {
                            printf("您输入的编号重复\n");
                            judge=1;
                        }
                }
                gp=GPmove(Qg,number);
                strcpy((*gp).number,number2);
                cp=CPmove(Qc,number);
                strcpy((*cp).number,number2);
                while(zp)
                {
                    if(!strcmp((*zp).number,number))
                        strcpy((*zp).number,number2);
                    zp=(*zp).next;
                }
                break;
            
            
                case '2':
                judge=1;
                while(judge)
                {
                    printf("请输入商品新的折扣,  0到1之间\n");
                    scanf("%f",&discount);
    
                    if(!((discount>0)&&(discount<=1)))
                    {    
        
                            if(discount>1)
                        {
                            printf("牛逼了啊!你还想打几折了?重新输入!\n\n");
                        }
                        else
                        {    
                        printf("倒贴钱你也敢卖东西?捐给希望工程算了,重新输入!!!\n\n");
                        }
            
                    }
                    else
                    {
                        judge=0;
                    }
                }
                
                (*gp).discount=discount;break;
        
            
            case '3':
                printf("请输入新的产品价格\n");
                scanf("%f",&price);
                (*gp).price=price;break;
        
            
            case '4':
                    judge=1;
                    while(judge)
                    {
                        printf("请输入新的商品名\n");
                         scanf("%s",&name);
                        if((name[0]=='\0')||(name[1]=='\0')||(name[2]=='\0')||(name[3]=='\0')||(name[4]=='\0')||(name[5]=='\0'))
                        {
                            judge=0;
                        }
                        else
                        {
                            printf("产品名字太长,搞简练点,做多五个字母\n\n\n");
                        }
                    }    
                    strcpy((*gp).name,name); break;
        }
        printf("请问还要修改吗这个商品的其他信息吗?是  Y      N\n");

        scanf("%s",&yesorno);
        if(yesorno=='Y')
        {
        }
        else
        {
            R=0;
        }
    }
    }
    else
    {
        printf("没有此种商品\n\n\n\n");
    }


}

void read(goodsinformation *Qg,zhangben *Qz,cangku *Qc)
{
        FILE *save;
        int judge=1;
        goodsinformation *s;
        zhangben *p;
        cangku *q;
    
                save=fopen("xinxi.txt","rb");
                 while(judge)
                 {        
                    
                     s=(goodsinformation *)malloc(sizeof(goodsinformation));
                        if(fread(s,sizeof(struct goodsinformation),1,save))
                        {
                             if((*Qg).next)
                            {
                                (*s).next=(*Qg).next;
                                (*Qg).next=s;
                            }
                            else
                            {
                                (*Qg).next=s;
                                (*s).next=NULL;
                            }
                        }
                        else
                        {
                            free(s);
                            judge=0;
                        }
                 }
                 fclose(save);


                judge=1;
                 save=fopen("zhangben.txt","rb");
                 while(judge)
                 {        
                    
                     p=(zhangben *)malloc(sizeof(zhangben));
                        if(fread(p,sizeof(struct zhangben),1,save))
                        {
                             if((*Qz).next)
                            {
                                (*p).next=(*Qz).next;
                                (*Qz).next=p;
                            }
                            else
                            {
                                (*Qz).next=p;
                                (*p).next=NULL;
                            }
                        }
                        else
                        {
                            free(p);
                            judge=0;
                        }
                 }
                 fclose(save);

                 judge=1;
                 save=fopen("cangku.txt","rb");
                 while(judge)
                 {        
                    
                     q=(cangku *)malloc(sizeof(cangku));
                        if(fread(q,sizeof(struct cangku),1,save))
                        {
                             if((*Qc).next)
                            {
                                (*q).next=(*Qc).next;
                                (*Qc).next=q;
                            }
                            else
                            {
                                (*Qc).next=q;
                                (*q).next=NULL;
                            }
                        }
                        else
                        {
                            free(q);
                            judge=0;
                        }
                 }
                 fclose(save);
}

void write(goodsinformation *Qg,zhangben *Qz,cangku *Qc)
{
    FILE *save;
    int judge=1;
    goodsinformation *s;
    zhangben *p;
    cangku *q;
    
    s=Qg;
    save=fopen("xinxi.txt","wb");
    while((*s).next)
    {
        s=(*s).next;
        fwrite(s,sizeof(struct goodsinformation),1,save);
    }

    save=fopen("zhangben.txt","wb");
    p=Qz;
    while((*p).next)
    {
        p=(*p).next;
        fwrite(p,sizeof(struct zhangben),1,save);
    }

    save=fopen("cangku.txt","wb");
    q=Qc;
    while((*q).next)
    {
        q=(*q).next;
        fwrite(q,sizeof(struct cangku),1,save);
    }
}

    



void main()
{    


    cangku Qcangku;                                         /*三表建立在内存中*/
    cangku *Qc;    
    Qc=&Qcangku;
    (*Qc).next=NULL;

    goodsinformation Qgoodsinformation;
    goodsinformation *Qg;
    Qg=&Qgoodsinformation;
    (*Qg).next=NULL;

    zhangben Qzhangben;
    zhangben *Qz;
    Qz=&Qzhangben;
    (*Qz).next=NULL;


    
    
    read(Qg,Qz,Qc);
    
    char judge,number[6];
    do
    {

        printf("请问您想做什么?\n");
        printf("A商品进货\n");
        printf("B商品零售\n");
        printf("C仓库信息输出\n");
        printf("D账本信息输出\n");
        printf("E信息表信息输出\n");
        printf("F商品按编码输出\n");
        printf("G按编码输出买卖记录\n");
        printf("H删除信息表中信息\n");
        printf("M修改产品信息\n");
        printf("I表示插入新的商品信息\n\n\n\n\n");        
        printf("Z表示退出\n\n\n");
        scanf("%s",&judge);
        switch(judge)
        {
        case 'A':
            Gget(Qc,Qg,Qz);                continue;
        case 'B':
            Sell(Qc,Qg,Qz);  continue;
        case 'C':
            pcangku_print(Qc);  continue;
        case 'D':
            pzhangben_print(Qz,Qg);  continue;
        case 'E':
            pgoodsinformation_print(Qg);  continue;
        case 'F':
            {
                printf("请输入您要查询的编码\n");
                scanf("%s",number);
                shangpinxinxi_print(Qg,Qc,number);
                
            }continue;
        case 'G':
            {
                printf("请输入您要查询的编码\n");
                scanf("%s",number);
                zhangbenjilu_print(Qz,Qg,number);
            }continue;
        case 'H':
            {
                printf("请输入您要查询的编码\n");
                scanf("%s",number);
                Gooddelet(Qg,number);
            }continue;
            
        case 'I':
            {
                Goodsinis(Qg);
                continue;
            }
         case 'M':
            {
                modify(Qg,Qz,Qc);
                continue;
            }

        case 'Z':
            write(Qg,Qz,Qc);
            exit(0);
        
        }
        
    }
    while(1);
}
2007-12-30 22:24
suzh1987
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-12-30
收藏
得分:0 
补充
可能写的时候有些说明不是很充分,但是我感觉算法不难,如果你有什么不明白的,可以联系我
[email]suzh1987@[/email]
2007-12-30 22:29
快速回复:[急求]商品货架管理
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.028716 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved