C语言用链表实现管理系统

C语言用链表实现电脑配件管理系统

第一次发表Blog,有些问题处理的不是很好,望体谅,同学们可以在评论区询问我相关的问题并指出我的不足。

本人在某偏远地区末流985大学(就是这样:自己的学校只允许自己人喷)软件工程专业学习,大一第一个学期学习了C语言,第二个学期前两个月要求编写C语言完整的管理系统,这个管理系统主要由我和我的一个队友用完成。(第一次编写完整的C语言程序,题目要求接近完成,但我自己对这个系统还有很多不满意的地方,关注我Blog,我以后会只用C语言对此系统一直修改完善,强迫症,莫得办法。。)

发一下大体要求:(具体要求未征询出题老师同意,不方便透露)
C语言用链表实现管理系统_第1张图片
补充:
1.我们设定批发时,规定数量50,规定额度5000,如果超过就会出现赠品。
2.在统计金额时,默认初始资金为5,000,000。

遇到的问题有很多,大部分都尝试解决了。下面分享一下编写电脑配件管理系统的要注意的地方与我们的代码,希望对同学们有帮助。

1.重点)首先一定要仔细读题,理解题目。把题目中的每一个要求都读懂,不要和我们一样,在编程中期时发现我们写的函数有些与题目中的要求不一样,才修改,而且因为程序是一个整体,所以大改会有些麻烦。但是,即使我们又理解了一遍题意,仍然有些地方没有处理好。例如:按照(4)中要求题目中暗示要将配件按照大小型分类,但我们完全没有考虑到这个问题。

2.重点)一定要先写好主函数,然后在编写每一个分函数,思路要清晰。我发一下我写的主函数,大家可以借鉴一下。

//主函数
int main(int argc, char *argv[]){
    system("color F5");//背景颜色
    SetConsoleTitle("计算机配件管理系统");//标题
    login();//登入函数
    while(1)//无限循环
    {
        switch(menu())//选择函数
        {
            case 0:
                system("CLS");
                rewrite();//密码修改函数
                break;

            case 1:
                system("CLS");
                gotoxy(55,1);//光标移动函数
                printf("*------------------------------计算机配件信息添加-----------------------------*");
                add();//添加函数
                break;

            case 2:
                system("CLS");
                money();//可以实时改变的统计金额函数
                gotoxy(55,6);
                printf("*------------------------------计算机配件信息修改-----------------------------*");
                revise();//修改函数
                break;

            case 3:
                system("CLS");
                gotoxy(55,6);
                printf("*------------------------------计算机配件信息删除-----------------------------*");
                Delete();//删除函数
                break;

            case 4:
                system("CLS");
                money();
                gotoxy(55,6);
                printf("*-------------------------按照顺序排序生成目前库存报表-----------------------*");
                queryone();//库存函数
                break;

            case 5:
                system("CLS");
                money();
                gotoxy(55,6);
                printf("*-------------------------按照时间排序成目前库存报表-----------------------*");
                querytwo();//按照时间排序
                break;

            case 6:
                system("CLS");
                money();
                gotoxy(55,6);
                printf("*-------------------------计算机配件信息查询(顺序排序)-----------------------*");
                choice();//查询函数
                break;

            case 7:
                system("CLS");
                money();
                gotoxy(55,2);
                printf("*------------------------------计算机配件统计赠品-----------------------------*");
                statisticsfour();//统计赠品函数
                break;

            case 8:
                system("CLS");
                money();
                gotoxy(55,1);
                printf("*---------------------------计算机配件进货时间查询----------------------------*");
                timequery();//时间查询函数
                break;

            case 9:
                system("CLS");
                end();//结束函数
                break;
        }
    }
    return 0;
}

3.程序中出现名称的地方尽量用英语来表示,用汉语拼音来表示感觉有点难受(个人观点)。(我们写到大概三分之一时,发现了这个问题,改的时候也比较麻烦)

4.一定要写注释,有的同学为了省事,注释写的很少,这会影响程序的可读性,而且以后自己想要修改也会有些麻烦。我们也做的不好,前期写的还挺多,后期也懒得写了。(但我会在我的博客上慢慢增加的)

完整代码
(分函数按照在主函数中出现的顺序排列)
下面分享一下我们写的完整代码与运行过程图片,再之后会在之后我的Blog中对我感觉重要的函数进行讲解。(按照具体要求,我们不需要在程序中创建文本文件,所以要求我们提前在外部C语言程序所在文件中创建好txt文件,而且要在不同的txt文件中按照规定的格式(在写入文件函数中寻找)输入至少一条信息,当然,这些样本文件我也会上传到我的Blog上【估计两三天以后就会审核通过】,如果大家想直接运行程序,可以先下载并将其移动其到正确位置即可运行

#include
#include
#include
#include
#include
#include
#include 

//密码
char passport[99]="123456";//初始密码为123456
//时间结构体
struct time{
    char month[20];
    char day[20];
    char hour[20];
    char minute[20];
};

//配件结构体
struct buygoods{
    struct time in;
    char name[20];
    char type[20];
    char creat[20];//制造商
    char unitprice[20];//单价
    char amount[20];
    char totalprice[20];//总价
    char supplier[20];
    struct buygoods*next;
};

//配件+赠品结构体
struct giftgoods{
    struct time in;
    char name[20];
    char type[20];
    char creat[20];//制造商
    char unitprice[20];//单价
    char amount[20];
    char totalprice[20];//总价
    char supplier[20];//供货商
    char present[20];//赠品
    struct giftgoods*next;
};

void login();//登入函数
bool is_pass();//密码函数
int menu();//菜单函数
void money();//统计营业额、盈利额
void gotoxy();//光标移动函数
void add();//添加函数
void Time(char*,char*,char*,char*);//时间函数
void jd(char*);//时间完善函数
void jd1(char*);//检验回车函数
int judge(char*);//检验字符函数
void surplus(char*,char*,char*,char*,char*,char*);//剩余输入
void rewrite();//修改密码
int deal(struct buygoods *,int*);//库存检验函数

void writefileone(struct buygoods*h);//写入进货记录文件函数
void writefiletwo(struct buygoods*h);//写入批发销售文件函数
void writefilethree(struct buygoods*h);//写入零售销售入文件函数
void writefilefour(struct giftgoods*h);//写入批发赠品函数

struct buygoods*readfileone();//读入进货记录函数
struct buygoods*readfiletwo();//读批发销售入函数
struct buygoods*readfilethree();//读入零售销售函数
struct giftgoods*readfilefour();//读入批发赠品函数

void revise();//修改函数
void Delete();//删除函数
void queryone();//按照顺序排序生成目前的库存报表

void statisticsone();//统计进货记录函数
void statisticstwo();//统计批发销售货物函数
void statisticsthree();//统计零售销售函数
void statisticsfour();//统计批发赠品函数

void querytwo();//按照时间排序生成目前的库存报表
void choice();//查询函数
int menutwo();//选择录入菜单
void choiceone();//排序配件函数
void choicetwo();//排序供货商函数
void choicethree();//排序客户历史采购信息函数

void timequery();//按照时间查询函数
void end();//结束界面

//主函数
int main(int argc, char *argv[]){
    system("color F5");
    SetConsoleTitle("计算机配件管理系统");
    login();
    while(1)
    {
        switch(menu())
        {
            case 0:
                system("CLS");
                rewrite();
                break;

            case 1:
                system("CLS");
                gotoxy(55,1);
                printf("*------------------------------计算机配件信息添加-----------------------------*");
                add();
                break;

            case 2:
                system("CLS");
                money();
                gotoxy(55,6);
                printf("*------------------------------计算机配件信息修改-----------------------------*");
                revise();
                break;

            case 3:
                system("CLS");
                gotoxy(55,6);
                printf("*------------------------------计算机配件信息删除-----------------------------*");
                Delete();
                break;

            case 4:
                system("CLS");
                money();
                gotoxy(55,6);
                printf("*-------------------------按照顺序排序生成目前库存报表-----------------------*");
                queryone();
                break;

            case 5:
                system("CLS");
                money();
                gotoxy(55,6);
                printf("*-------------------------按照时间排序成目前库存报表-----------------------*");
                querytwo();
                break;

            case 6:
                system("CLS");
                money();
                gotoxy(55,6);
                printf("*-------------------------计算机配件信息查询(顺序排序)-----------------------*");
                choice();
                break;

            case 7:
                system("CLS");
                money();
                gotoxy(55,2);
                printf("*------------------------------计算机配件统计赠品-----------------------------*");
                statisticsfour();
                break;

            case 8:
                system("CLS");
                money();
                gotoxy(55,1);
                printf("*---------------------------计算机配件进货时间查询----------------------------*");
                timequery();
                break;

            case 9:
                system("CLS");
                end();
                break;
        }
    }
    return 0;
}

//登入函数
void login(){
    gotoxy(60,14);
    puts("---------------------------------------------------------------");
    gotoxy(60,18);
    puts("------------欢 迎 来 到 计 算 机 配 件 管 理 系 统-------------");
    gotoxy(60,22);
    puts("---------------------------------------------------------------");
    gotoxy(60,24);
    puts("---------------------请按任意键继续!--------------------------");
    gotoxy(85,28);
    getch();
    system("cls");
    char pas[99999];
    int i;
    i=5;
    int length,length1;
    while(i>0)
    {
        gotoxy(60,15);
        puts("-----------------------------------------------------------------------");
        gotoxy(60,18);
        printf("--------------请输入密码:(密码为6位,错误次数还剩%i次)----------------\n",i);
        gotoxy(60,21);
        puts("-----------------------------------------------------------------------");
        gotoxy(85,24);
        int q=0;
        while((pas[q]=getch())!='\r')
       {
           if(pas[q]=='\b')
          {
            printf("\b \b");
            q--;
          }
           else
          {
            printf("*");
            q++;
          }
       }
        pas[q]='\0';
        length=strlen(pas);
        length1=strlen(passport);
        if(is_pass(pas)&&length==length1)
        {
            break;
        }
        else
        {
            gotoxy(82,28);
            puts("密码错误,请重新输入");
            gotoxy(82,31);
            puts("请按任意键继续!");
            gotoxy(82,33);
            getch();
            i--;
            if(i>0)
                system("cls");
            continue;
        }
    }
    if(i==0)
    {
        system("cls");
        gotoxy(60,15);
        puts("------------------------------------------------------------------------");
        gotoxy(60,19);
        puts("--------------您输入密码错误次数已达5次,无法使用该程序!---------------");
        gotoxy(60,23);
        puts("-------------------------------------------------------------------------");
        exit(0);
    }
}

//密码函数
bool is_pass(char *ch){
    int i;
    for(i=0; i<6; i++)
    {
        if(passport[i]!=*(ch+i))
            return 0;
    }
    return 1;

}

//菜单函数
int menu(){
    char n;
    do
    {
        system("cls");
        gotoxy(55,6);
        printf("*------------------------------计算机配件管理系统-----------------------------*");
        gotoxy(55,10);
        printf("\t\t\t|-------------------------------------------------|\n");
        gotoxy(55,11);
        printf("\t\t\t|                                                 |\n");
        gotoxy(55,12);
        printf("\t\t\t|                  *欢迎使用                      |\n");
        gotoxy(55,13);
        printf("\t\t\t|                                                 |\n");
        gotoxy(50,14);
        printf("\t\t\t|-------------------------------------------------|\n");
        gotoxy(55,15);
        printf("\t\t\t|                                                 |\n");
        gotoxy(50,16);
        printf("\t\t\t|          0.修改密码                             |\n");
        gotoxy(55,17);
        printf("\t\t\t|                                                 |\n");
        gotoxy(50,18);
        printf("\t\t\t|          1.添加信息                             |\n");
        gotoxy(55,19);
        printf("\t\t\t|                                                 |\n");
        gotoxy(50,20);
        printf("\t\t\t|          2.修改信息                             |\n");
        gotoxy(55,21);
        printf("\t\t\t|                                                 |\n");
        gotoxy(50,22);
        printf("\t\t\t|          3.删除信息                             |\n");
        gotoxy(55,23);
        printf("\t\t\t|                                                 |\n");
        gotoxy(50,24);
        printf("\t\t\t|          4.按照顺序排序生成交易信息报表         |\n");
        gotoxy(55,25);
        printf("\t\t\t|                                                 |\n");
        gotoxy(50,26);
        printf("\t\t\t|          5.按照时间排序生成交易信息报表         |\n");
        gotoxy(55,27);
        printf("\t\t\t|                                                 |\n");
        gotoxy(50,28);
        printf("\t\t\t|          6.查询(按照顺序排序)                  |\n");
        gotoxy(55,29);
        printf("\t\t\t|                                                 |\n");
        gotoxy(50,30);
        printf("\t\t\t|          7.统计赠品信息                         |\n");
        gotoxy(55,31);
        printf("\t\t\t|                                                 |\n");
        gotoxy(50,32);
        printf("\t\t\t|          8.打印某段时间范围内的交易信息         |\n");
        gotoxy(55,33);
        printf("\t\t\t|                                                 |\n");
        gotoxy(50,34);
        printf("\t\t\t|          9.退出                                 |\n");
        gotoxy(55,35);
        printf("\t\t\t|                                                 |\n");
        gotoxy(50,36);
        printf("\t\t\t|-------------------------------------------------|\n");
        gotoxy(35,38);
        printf("\t\t\t   请选择0-9:");
        n=getch();
    }while(n<'0'||n>'9');
    return (n-48);
}

//统计营业额、盈利额
void money(){
    struct buygoods*h,*p;
    float  businessvolume=0,purchasevolume=0,salesvolume=0,i;
    h=readfiletwo();
    for(p=h;p->next!=NULL;p=p->next)
    {
        i=atof(p->totalprice);
        businessvolume+=i;
    }
    h=readfilethree();
    for(p=h;p->next!=NULL;p=p->next)
    {
        i=atof(p->totalprice);
        businessvolume+=i;
    }
    gotoxy(130,40);
    printf("%10s","营业额(销售总额)");
    gotoxy(130,41);
    printf("----------------------------------");
    gotoxy(130,42);
    printf("%10f",businessvolume);

    h=readfileone();
    for(p=h;p->next!=NULL;p=p->next)
    {
        i=atof(p->totalprice);
        purchasevolume+=i;
    }
    salesvolume=businessvolume-purchasevolume;
    gotoxy(130,43);
    printf("%10s\n","盈利额(销售额-进货额)");
    gotoxy(130,44);
    printf("----------------------------------");
    gotoxy(130,45);
    printf("%10f",salesvolume);
    gotoxy(130,46);
    printf("%10s\n","流动资金");
    gotoxy(130,47);
    printf("----------------------------------");
    gotoxy(130,48);
    printf("%10f",5000000+salesvolume);
    gotoxy(0,0);
}

//光标移动函数
void gotoxy(int x,int y){
    COORD pos= {x,y};               //一个坐标结构体,代表窗口的点阵
    HANDLE hOutput;
    /*将调用的参数读入结构体,编译得到窗口上一个具体的坐标*/
    hOutput=GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleCursorPosition(hOutput,pos);
    /*句柄操作,实现对光标的移动*/
}

//时间完善函数
void jd(char *a){
    int length;
    char y[3];
    length=strlen(a);
    if(length==0)
    {
        strcpy(a,"未知");
    }
    if(length==1)
    {
        y[0]='0';
        y[1]=a[0];
        strcpy(a,y);
    }
}

//检验字符函数
void jd1(char *a){
    int length;
    length=strlen(a);
    if(length==0)
    {
        strcpy(a,"未知");
    }
}

//添加函数
void add(){
    gotoxy(55,1);
    printf("*------------------------------计算机配件信息添加-----------------------------*");
    money();
    int kucun;
    int kuc[16],kn;
    FILE *fk;
    if((fk=fopen("计算机配件库存数量信息.txt","r"))==NULL)
    {
       printf("\t\t文件出错,按任意键退出!");
       getch();
       exit(1);
     }
     for(kn=0;kn<16;kn++)
     {
         fscanf(fk,"%8d",&kuc[kn]);
     }
     fclose(fk);
    struct buygoods *h,*t;
    char a;
    int l1,l2,l3,l4;
    printf("\n\n");
    gotoxy(0,4);
    printf("\t\t_____________________________________\n");
    gotoxy(0,5);
    printf("\t\t|                                    |\n");
    gotoxy(0,6);
    printf("\t\t|        *输入1添加进货记录          |\n");
    gotoxy(0,7);
    printf("\t\t|        *输入2添加批发销售          |\n");
    gotoxy(0,8);
    printf("\t\t|        *输入3添加零售销售          |\n");
    gotoxy(0,9);
    printf("\t\t|______________按0返回_______________|\n");
    gotoxy(200,4);
    printf("\n\t\t |--------------------------------------当前库存--------------------------------------------------------------------------|\n");
    gotoxy(200,5);
    printf("\n\t\t |         A.A型   %8d个           A.A型   %8d个            A.A型   %8d个              A.A型   %8d个  |\n",kuc[0],kuc[4],kuc[8],kuc[12]);
    gotoxy(200,6);
    printf("\n\t\t | 1.键盘  B.B型   %8d个   2.鼠标  B.B型   %8d个    3.显卡  B.B型   %8d个   4.移动硬盘 B.B型   %8d个  |\n",kuc[1],kuc[5],kuc[9],kuc[13]);
    gotoxy(200,7);
    printf("\n\t\t |         C.C型   %8d个           C.C型   %8d个            C.C型   %8d个              C.C型   %8d个  |\n",kuc[2],kuc[6],kuc[10],kuc[14]);
    gotoxy(200,8);
    printf("\n\t\t |         D.D型   %8d个           D.D型   %8d个            D.D型   %8d个              D.D型   %8d个  |\n",kuc[3],kuc[7],kuc[11],kuc[15]);
    gotoxy(200,9);
    printf("\n\t\t |-----------------------------------------------------------------------------------------------------------------------|\n");
    gotoxy(200,10);
    printf("\n\t\t|--------您所需要添加的信息------|");
    gotoxy(200,11);
    printf("\n\t\t| (输入)时间:月 日 时 分        |");
    gotoxy(200,12);
    printf("\n\t\t|       (选择)配件种类         |");
    gotoxy(200,13);
    printf("\n\t\t|       (选择)配件型号         |");
    gotoxy(200,14);
    printf("\n\t\t|       (选择)配件数量         |");
    gotoxy(200,15);
    printf("\n\t\t|  (输入)供货商/客户信息       |");
    gotoxy(200,16);
    printf("\n\t\t|--------------------------------|\n");
    while(a!='1'&&a!='2'&&a!='3'&&a!='0')
    {
        a=getch();
    }
    if(a=='0')
    {
        return;
    }
    if(a=='1')
    {
        h=readfileone();
        printf("\n添加进货记录:");
    }
    else if(a=='2')
    {
        h=readfiletwo();
        printf("\n添加批发记录:");
    }
    else if(a=='3')
    {
        h=readfilethree();
        printf("\n添加零售记录:\n");
    }
    printf("\n\t\t_____________________________________________________\n");
    printf("\t\t|________________添加配件信息_______________________|\n");
    printf("\t\t|___________________________________________________|\n");
    printf("\n\t*注意事项:若您不知道所让输入的信息,直接按回车键跳过(月、日输入0会默认为未知时间)!\n");
    t=(struct buygoods*)malloc(sizeof(struct buygoods));
    Time(t->in.month,t->in.day,t->in.hour,t->in.minute);
    surplus(t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice);
    float i=atof(t->totalprice);
    if(i-10000000>0)
    {
        printf("\n\t\t超过最高额度,无法录入,按任意键直接返回!");
        getch();
        return;
    }
    printf("\n");
    int lengthc,n,n1;
    int flag=0;
    if(a=='1')
    {
        printf("\n\t\t*请输入供货商:");  gets(t->supplier); jd1(t->supplier);
        lengthc=strlen(t->supplier); n1=lengthc;
        while(flag==0)
      {
         flag=1;
         for(n=0;nsupplier[n]==' ')
             {
                n1--;
                flag=0;
                break;
             }
         }
         if(n1!=lengthc)
         {
              printf("\n\t\t*输入不合理,请重新输入(不能包含空格)");
              printf("\n\n\t\t*请输入供货商:");  gets(t->supplier);jd1(t->supplier);
              lengthc=strlen(t->supplier);n1=lengthc;
         }
       }
        if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"A型")==0) kuc[0]+=atoi(t->amount);
        else if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"B型")==0) kuc[1]+=atoi(t->amount);
        else if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"C型")==0) kuc[2]+=atoi(t->amount);
        else if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"D型")==0) kuc[3]+=atoi(t->amount);
        else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"A型")==0) kuc[4]+=atoi(t->amount);
        else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"B型")==0) kuc[5]+=atoi(t->amount);
        else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"C型")==0) kuc[6]+=atoi(t->amount);
        else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"D型")==0) kuc[7]+=atoi(t->amount);
        else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"A型")==0) kuc[8]+=atoi(t->amount);
        else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"B型")==0) kuc[9]+=atoi(t->amount);
        else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"C型")==0) kuc[10]+=atoi(t->amount);
        else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"D型")==0) kuc[11]+=atoi(t->amount);
        else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"A型")==0) kuc[12]+=atoi(t->amount);
        else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"B型")==0) kuc[13]+=atoi(t->amount);
        else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"C型")==0) kuc[14]+=atoi(t->amount);
        else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"D型")==0) kuc[15]+=atoi(t->amount);

         t->next=h->next;
         h->next=t;
         writefileone(h);
    }
    if(a=='3')
    {
        printf("\n\t\t*请输入客户信息:");  gets(t->supplier);jd1(t->supplier);
        lengthc=strlen(t->supplier); n1=lengthc;
        while(flag==0)
      {
         flag=1;
         for(n=0;nsupplier[n]==' ')
             {
                n1--;
                flag=0;
                break;
             }
         }
         if(n1!=lengthc)
         {
              printf("\n\t\t*输入不合理,请重新输入(不能包含空格)");
              printf("\n\n\t\t*请输入供货商:");  gets(t->supplier);jd1(t->supplier);
              lengthc=strlen(t->supplier);n1=lengthc;
         }
       }
       kucun=deal(t,kuc);
       if(kucun==1)
       {
           printf("\n\t\t该配件库存不足/库存中无此配件,请按任意键重新输入;");
           getch();
           system("cls");
           return;
       }
            if(kucun==0)
     {
        if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"A型")==0) kuc[0]-=atoi(t->amount);
        else if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"B型")==0) kuc[1]-=atoi(t->amount);
        else if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"C型")==0) kuc[2]-=atoi(t->amount);
        else if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"D型")==0) kuc[3]-=atoi(t->amount);
        else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"A型")==0) kuc[4]-=atoi(t->amount);
        else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"B型")==0) kuc[5]-=atoi(t->amount);
        else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"C型")==0) kuc[6]-=atoi(t->amount);
        else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"D型")==0) kuc[7]-=atoi(t->amount);
        else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"A型")==0) kuc[8]-=atoi(t->amount);
        else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"B型")==0) kuc[9]-=atoi(t->amount);
        else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"C型")==0) kuc[10]-=atoi(t->amount);
        else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"D型")==0) kuc[11]-=atoi(t->amount);
        else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"A型")==0) kuc[12]-=atoi(t->amount);
        else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"B型")==0) kuc[13]-=atoi(t->amount);
        else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"C型")==0) kuc[14]-=atoi(t->amount);
        else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"D型")==0) kuc[15]-=atoi(t->amount);
          printf("\n\t\t*该信息已存入");
          getch();
       }
     t->next=h->next;
     h->next=t;
     writefilethree(h);;
    }
    if(a=='2')
    {
        printf("\n\t\t*请输入客户信息:");  gets(t->supplier);jd1(t->supplier);
        lengthc=strlen(t->supplier); n1=lengthc;
        while(flag==0)
      {
         flag=1;
         for(n=0;nsupplier[n]==' ')
             {
                n1--;
                flag=0;
                break;
             }
         }
         if(n1!=lengthc)
         {
              printf("\n\t\t*输入不合理,请重新输入(不能包含空格)");
              printf("\n\n\t\t*请输入供货商:");  gets(t->supplier);jd1(t->supplier);
              lengthc=strlen(t->supplier);n1=lengthc;
         }
       }
       kucun=deal(t,kuc);
       if(kucun==1)
       {
           printf("\n\t\t该配件库存不足/库存中无此配件,请按任意键重新输入;");
           getch();
           system("cls");
           return;
       }
       if(kucun==0)
     {
        if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"A型")==0) kuc[0]-=atoi(t->amount);
        else if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"B型")==0) kuc[1]-=atoi(t->amount);
        else if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"C型")==0) kuc[2]-=atoi(t->amount);
        else if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"D型")==0) kuc[3]-=atoi(t->amount);
        else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"A型")==0) kuc[4]-=atoi(t->amount);
        else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"B型")==0) kuc[5]-=atoi(t->amount);
        else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"C型")==0) kuc[6]-=atoi(t->amount);
        else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"D型")==0) kuc[7]-=atoi(t->amount);
        else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"A型")==0) kuc[8]-=atoi(t->amount);
        else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"B型")==0) kuc[9]-=atoi(t->amount);
        else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"C型")==0) kuc[10]-=atoi(t->amount);
        else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"D型")==0) kuc[11]-=atoi(t->amount);
        else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"A型")==0) kuc[12]-=atoi(t->amount);
        else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"B型")==0) kuc[13]-=atoi(t->amount);
        else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"C型")==0) kuc[14]-=atoi(t->amount);
        else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"D型")==0) kuc[15]-=atoi(t->amount);
     }
        t->next=h->next;
        h->next=t;
        writefiletwo(h);
        char number[]="50";
        char price[]="5000";
        l1=strlen(t->amount);
        l2=strlen(t->totalprice);
        l3=strlen(number);
        l4=strlen(price)+3;
        if((l1>l3)||((strcmp(t->amount,number)>0)&&(l1==l3))||(l2>l4)||((strcmp(t->totalprice,price)>0)&&(l2==l4)))
        {
            struct giftgoods *head,*temp;
            head=readfilefour();
            temp=(struct giftgoods*)malloc(sizeof(struct giftgoods));
            strcpy(temp->in.month,t->in.month);
            strcpy(temp->in.day,t->in.day);
            strcpy(temp->in.hour,t->in.hour);
            strcpy(temp->in.minute,t->in.minute);
            strcpy(temp->name,t->name);
            strcpy(temp->type,t->type);
            strcpy(temp->creat,t->creat);
            strcpy(temp->unitprice,t->unitprice);
            strcpy(temp->amount,t->amount);
            strcpy(temp->totalprice,t->totalprice);
            strcpy(temp->supplier,t->supplier);
            printf("\n\t\t*由于您批发数量超过规定数量或者批发销售总价超过规定额度, 附赠您一件其他配件");
            printf("\n");
            FILE *f;
            int i,j,n;
            int b[10];
            char a[10][20]= {{"无线键盘"},{"无线鼠标"},{"16G内容条"},{"低配显卡"},{"8GU盘"},{"16G磁盘"},{"光驱"},{"降温风扇"},{"无线网卡"},{"蓝牙音响"}};
            int z[3],q,length;
            srand((unsigned)time(NULL));
            if((f=fopen("计算机配件赠品数量信息.txt","r"))==NULL)
            {
                printf("\t\t文件出错,按任意键退出!");
                getch();
                exit(1);
            }
            printf("\n\t\t-----------------------------------------现存库存信息--------------------------------------------------------------");
            printf("\n\t\t%10s%10s%10s%10s%10s%10s%10s%10s%10s%10s\n","无线键盘","无线鼠标","16G内容条","低配显卡","8GU盘","16G磁盘","光驱","降温风扇","无线网卡","蓝牙音响");
            printf("\n\t\t-----------------------------------------------------------------------------------------------------------------\n");
            for(n=0; n<10; n++)
            {
                fscanf(f,"%2d",&b[n]);
            }
            printf("\t\t");
            for(n=0; n<10; n++)
            {
                printf("         %d",b[n]);
            }
            fclose(f);
        start:
            for(j=0; j<3; j++)
            {
                z[j]=rand()%10;
                for(i=0; i2)
    {
        printf("\n\t\t*输入格式错误,请重新输入!\n");
        goto menu;
    }
    else
    {
        if(caozuo[0]>'3')
        {
            printf("\n\t\t*输入格式错误,请重新输入!\n");
            goto menu;
        }
        else
        {
            if(caozuo[0]=='1')
            {
                w=z[0];
                if(b[w]<=0)
                {
                    printf("\n\t\t*该赠品已缺货,请重新选择!");
                    printf("\n");
                    goto start;
                }
                else
                {
                    printf("\t\t*附赠您一个");
                    for(i=0; i<20; i++)
                    {
                        printf("%c",a[w][i]);
                    }
                    strcpy(temp->present,a[w]);
                    b[w]-=1;
                    getch();
                }

            }
            if(caozuo[0]=='2')
            {
                w=z[1];
                if(b[w]<=0)
                {
                    printf("\t\t*该赠品已缺货,请重新选择!");
                    printf("\n");
                    goto start;
                }
                else
                {
                    printf("\t\t*附赠您一个");
                    for(i=0; i<20; i++)
                    {
                        printf("%c",a[w][i]);
                    }
                    strcpy(temp->present,a[w]);
                    b[w]-=1;
                    getch();
                }

            }
            if(caozuo[0]=='3')
            {
                w=z[2];
                if(b[w]<=0)
                {
                    printf("\t\t*该赠品已缺货,请重新选择!");
                    printf("\n");
                    goto start;
                }
                else
                {
                    printf("\t\t*附赠您一个");
                    for(i=0; i<20; i++)
                    {
                        printf("%c",a[w][i]);
                    }
                    strcpy(temp->present,a[w]);
                    b[w]-=1;
                    getch();
                }

            }
        }
    }
            f=fopen("计算机配件赠品数量信息.txt","w");
            fclose(f);
            f=fopen("计算机配件赠品数量信息.txt","a+");
            for(n=0; n<10; n++)
            {
                fprintf(f,"%2d",b[n]);
            }
            fclose(f);;
            temp->next=head->next;
            head->next=temp;
            writefilefour(head);
        }
    }
    fk=fopen("计算机配件库存数量信息.txt","w");
    fclose(fk);
    fk=fopen("计算机配件库存数量信息.txt","a+");
    for(kn=0; kn<16; kn++)
    {
        fprintf(fk,"%8d",kuc[kn]);
    }
    fclose(fk);
    money();
    gotoxy(130,50);
    printf("*该信息已存入");
    gotoxy(130,52);
    printf("资金信息已修改。");
    gotoxy(130,54);
    printf("*按任意键返回!\n");
    gotoxy(130,55);
    getch();


}

//时间输入函数
void Time(char a[],char b[],char c[],char d[]){
    printf("\n\t*请输入月:");    gets(a); float A=atof(a);
    while((judge(a)==0)||(A<0)||(A>12)||(A!=(int)A))
    {
        printf("\n\t*输入不合理,请重新输入!\n");
        printf("\n\t");
        gets(a);A=atof(a);
    }
    if(a[0]=='0')
    {
        strcpy(a,"未知");
    }
    jd(a);
    printf("\n\t*请输入日:");    gets(b); float B=atof(b);
    while((judge(b)==0)||(B<0)||(B>30)||(B!=(int)B))
    {
        printf("\n\t*输入不合理,请重新输入!\n");
        printf("\n\t");
        gets(b);B=atof(b);
    }
    if(b[0]=='0')
    {
        strcpy(b,"未知");
    }
    jd(b);
    printf("\n\t*请输入时:");    gets(c); float C=atof(c);
    while((judge(c)==0)||(C<0)||(C>24)||(C!=(int)C))
    {
        printf("\n\t*输入不合理,请重新输入!\n");
        printf("\n\t");
        gets(c);C=atof(c);
    }
    jd(c);
    printf("\n\t*请输入分:");    gets(d); float D=atof(d);
    while((judge(d)==0)||(D<0)||(D>60)||(D!=(int)D))
    {
        printf("\n\t*输入不合理,请重新输入!\n");
        printf("\n\t");
        gets(d);D=atof(d);
    }
    jd(d);
}

//剩余输入
void surplus(char a[],char b[],char c[],char d[],char e[],char f[]){
    printf("\n\t\t |-------------------------------------------------------------------------------------------------------------|\n");
    printf("\n\t\t |         A.A型   50元/个           A.A型   50元/个            A.A型   100元/个              A.A型   20元/个  |\n");
    printf("\n\t\t | 1.键盘  B.B型   60元/个   2.鼠标  B.B型   60元/个    3.显卡  B.B型   110元/个   4.移动硬盘 B.B型   30元/个  |\n");
    printf("\n\t\t |         C.C型   70元/个           C.C型   70元/个            C.C型   120元/个              C.C型   40元/个  |\n");
    printf("\n\t\t |         D.D型   80元/个           D.D型   80元/个            D.D型   130元/个              D.D型   50元/个  |\n");
    printf("\n\t\t |-------------------------------------------------------------------------------------------------------------|\n");
    printf("\n\t\t*请选择配件名称(1-4):");
    char i;
    do
    {
        i=getch();
        if(i=='1')   strcpy(a,"键盘");
        else if(i=='2')   strcpy(a,"鼠标");
        else if(i=='3')   strcpy(a,"显卡");
        else if(i=='4')   strcpy(a,"移动硬盘");
    }while(i<'1'||i>'4');
    printf("\n\n\t\t*您选择的配件名称为:%s",a);
    printf("\n\n\t\t*请选择配件型号(A-D):");
    char j;
    do
    {
        j=getch();
        if(j=='A')   strcpy(b,"A型");
        else if(j=='B')   strcpy(b,"B型");
        else if(j=='C')   strcpy(b,"C型");
        else if(j=='D')   strcpy(b,"D型");
    }while(j<'A'||j>'D');
    printf("\n\n\t\t*您选择的配件型号为:%s",b);

    if(i=='1'&&j=='A') strcpy(d,"50");
    else if(i=='1'&&j=='B') strcpy(d,"60");
    else if(i=='1'&&j=='C') strcpy(d,"70");
    else if(i=='1'&&j=='D') strcpy(d,"80");
    else if(i=='2'&&j=='A') strcpy(d,"50");
    else if(i=='2'&&j=='B') strcpy(d,"60");
    else if(i=='2'&&j=='C') strcpy(d,"70");
    else if(i=='2'&&j=='D') strcpy(d,"80");
    else if(i=='3'&&j=='A') strcpy(d,"100");
    else if(i=='3'&&j=='B') strcpy(d,"110");
    else if(i=='3'&&j=='C') strcpy(d,"120");
    else if(i=='3'&&j=='D') strcpy(d,"130");
    else if(i=='4'&&j=='A') strcpy(d,"20");
    else if(i=='4'&&j=='B') strcpy(d,"30");
    else if(i=='4'&&j=='C') strcpy(d,"40");
    else if(i=='4'&&j=='D') strcpy(d,"50");
    printf("\n\n\t\t*该型号的单价为:%s元/个",d);
    printf("\n\n\t\t*请输入制造商:");  gets(c);jd1(c);
    int lengthc,n,n1;
    lengthc=strlen(c);
    int flag=0;
    n1=lengthc;
    while(flag==0)
    {
       flag=1;
        for(n=0;n34000000000000000000.0)
    {
        printf("\n\t\t*输入为负数或超界,请输入符合客观事实的数字!(按任意键继续)");
        getch();
        gets(e);jd1(e);
        E=atof(e);
    }
    while(E!=(int)E)
    {
        printf("\n\t\t*输入超界,请重新输入:");
        gets(e);jd1(e);
        E=atof(e);
    }
    float D=atof(d),F;
    F=D*E;
    sprintf(f,"%.2f",F);
    printf("\n\t\t*总价为:%s",f);
}

//检验字符函数
int judge(char str[]){
    int i=0;
    while(str[i++])
    if(!isdigit(str[i-1])&&str[i-1]!='.' && str[0]!='-' ) return 0;
    return 1;
}

//修改密码
void rewrite(){

        int length,length1;
        gotoxy(55,5);
        printf("*------------------------------计算机配件密码修改-----------------------------*");
        int flag;
        flag=0;
        gotoxy(0,10);
        printf("\n\n\t\t\t\t\t\t\t\t       *请输入原密码:");
        char pas[99999];
        int q=0;
        while((pas[q]=getch())!='\r')
        {
          if(pas[q]=='\b')
          {
            printf("\b \b");
            q--;
           }
            else
           {
             printf("*");
             q++;
           }
         }
        pas[q]='\0';
        while(flag==0)
        {
           length=strlen(pas);
           length1=strlen(passport);
           if(is_pass(pas)&&length==length1)
          {
              break;
          }
           else
          {
            printf("\n\n\t\t\t\t\t\t\t\t       *原密码输入错误!请重新输入。(按“#”退出密码修改)");
            printf("\n\n\t\t\t\t\t\t\t\t       *请重新输入:");
            q=0;strcpy(pas,"0");
            while((pas[q]=getch())!='\r')
            {
              if(pas[q]=='\b')
              {
                 printf("\b \b");
                 q--;
              }
              else
              {
                 printf("*");
                 q++;
              }
            }
           pas[q]='\0';
           if(pas[0]=='#')
           {
               return;
           }
         }
       }
        printf("\n\n\t\t\t\t\t\t\t\t       *请输入新密码:");
        q=0;strcpy(pas,"0");
        while((pas[q]=getch())!='\r')
        {
          if(pas[q]=='\b')
          {
            printf("\b \b");
            q--;
           }
            else
           {
             printf("*");
             q++;
           }
         }
        pas[q]='\0';
        strcpy(passport,pas);
        system("cls");
        login();
}

//库存检验函数
int deal(struct buygoods *p,int*a){
    int i,n;
    n=atoi(p->amount);
    if(strcmp(p->name,"键盘")==0&&strcmp(p->type,"A型")==0) i=0;
    if(strcmp(p->name,"键盘")==0&&strcmp(p->type,"B型")==0) i=1;
    if(strcmp(p->name,"键盘")==0&&strcmp(p->type,"C型")==0) i=2;
    if(strcmp(p->name,"键盘")==0&&strcmp(p->type,"D型")==0) i=3;
    if(strcmp(p->name,"鼠标")==0&&strcmp(p->type,"A型")==0) i=4;
    if(strcmp(p->name,"鼠标")==0&&strcmp(p->type,"B型")==0) i=5;
    if(strcmp(p->name,"鼠标")==0&&strcmp(p->type,"C型")==0) i=6;
    if(strcmp(p->name,"鼠标")==0&&strcmp(p->type,"D型")==0) i=7;
    if(strcmp(p->name,"显卡")==0&&strcmp(p->type,"A型")==0) i=8;
    if(strcmp(p->name,"显卡")==0&&strcmp(p->type,"B型")==0) i=9;
    if(strcmp(p->name,"显卡")==0&&strcmp(p->type,"C型")==0) i=10;
    if(strcmp(p->name,"显卡")==0&&strcmp(p->type,"D型")==0) i=11;
    if(strcmp(p->name,"移动硬盘")==0&&strcmp(p->type,"A型")==0) i=12;
    if(strcmp(p->name,"移动硬盘")==0&&strcmp(p->type,"B型")==0) i=13;
    if(strcmp(p->name,"移动硬盘")==0&&strcmp(p->type,"C型")==0) i=14;
    if(strcmp(p->name,"移动硬盘")==0&&strcmp(p->type,"D型")==0) i=15;
    if(a[i]next;t!=NULL;t=t->next)
    {
        fprintf(fp,"%s %s %s %s %s %s %s %s %s %s %s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
    }
    fclose(fp);
}

//写入批发销售文件函数
void writefiletwo(struct buygoods *h){
    struct buygoods *t;
    FILE*fp;
    if((fp=fopen("计算机配件批发销售信息.txt","wt"))==NULL)
    {
        printf("文件出错233,按任意键退出!");
        getch();
        exit(1);
    }
    for(t=h->next;t!=NULL;t=t->next)
    {
        fprintf(fp,"%s %s %s %s %s %s %s %s %s %s %s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
    }
    fclose(fp);
}

//写入零售销售文件函数
void writefilethree(struct buygoods *h){
    struct buygoods*t;
    FILE*fp;
    if((fp=fopen("计算机配件零售销售信息.txt","wt"))==NULL)
    {
        printf("文件出错233,按任意键退出!");
        getch();
        exit(1);
    }
    for(t=h->next;t!=NULL;t=t->next)
    {
        fprintf(fp,"%s %s %s %s %s %s %s %s %s %s %s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
    }
    fclose(fp);
}

//写入批发赠品文件函数
void writefilefour(struct giftgoods *h){
    struct giftgoods*t;
    FILE*fp;
    if((fp=fopen("计算机配件批发赠品信息.txt","wt"))==NULL)
    {
        printf("文件出错233,按任意键退出!");
        getch();
        exit(1);
    }
    for(t=h->next;t!=NULL;t=t->next)
    {
        fprintf(fp,"%s %s %s %s %s %s %s %s %s %s %s %s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier,t->present);
    }
    fclose(fp);
}

//读取进货记录文件函数
struct  buygoods*readfileone(){
    struct buygoods*rhead,*p,*t;
    FILE*fl;
    fl=fopen("计算机配件进货记录信息.txt","rt");
    rhead=(struct buygoods*)malloc(sizeof(struct buygoods));
    rhead->next=NULL;
    p=rhead;
    while(!feof(fl))
    {
        t=(struct buygoods*)malloc(sizeof(struct buygoods));
        fscanf(fl,"%s %s %s %s %s %s %s %s %s %s %s",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
        p->next=t;
        p=t;
    }
    p->next=NULL;
    fclose(fl);
    return rhead;
}

//读取批发销售文件函数
struct buygoods*readfiletwo(){
    struct buygoods*rhead,*p,*t;
    FILE*fl;
    fl=fopen("计算机配件批发销售信息.txt","rt");
    rhead=((struct buygoods*)malloc(sizeof(struct buygoods)));
    rhead->next=NULL;
    p=rhead;
    while(!feof(fl))
    {
        t=(struct buygoods*)malloc(sizeof(struct buygoods));
        fscanf(fl,"%s %s %s %s %s %s %s %s %s %s %s",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
        p->next=t;
        p=t;
    }
    p->next=NULL;
    fclose(fl);
    return rhead;
}

//读取零售销售文件函数
struct  buygoods*readfilethree(){
    struct buygoods*rhead,*p,*t;
    FILE*fl;
    fl=fopen("计算机配件零售销售信息.txt","rt");
    rhead=((struct buygoods*)malloc(sizeof(struct buygoods)));
    rhead->next=NULL;
    p=rhead;
    while(!feof(fl))
    {
        t=(struct buygoods*)malloc(sizeof(struct buygoods));
        fscanf(fl,"%s %s %s %s %s %s %s %s %s %s %s",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
        p->next=t;
        p=t;
    }
    p->next=NULL;
    fclose(fl);
    return rhead;
}

//读取批发售销赠品文件函数
struct giftgoods*readfilefour(){
    struct giftgoods *rhead,*p,*t;
    FILE*f;
    f=fopen("计算机配件批发赠品信息.txt","rt");
    rhead=(struct giftgoods*)malloc(sizeof(struct giftgoods));
    rhead->next=NULL;
    p=rhead;
    while(!feof(f))
    {
        t=(struct giftgoods*)malloc(sizeof(struct giftgoods));
        fscanf(f,"%s %s %s %s %s %s %s %s %s %s %s %s",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier,t->present);
        p->next=t;
        p=t;
    }
    p->next=NULL;
    fclose(f);
    return rhead;
}

//修改函数
void revise(){
    system("CLS");
    money();
    int kuc[16],kn;
    FILE *fk;
    int lengthc,n,n1;
    int flag1=0;
    if((fk=fopen("计算机配件库存数量信息.txt","r"))==NULL)
    {
       printf("\t\t文件出错,按任意键退出!");
       getch();
       exit(1);
     }
     for(kn=0;kn<16;kn++)
     {
         fscanf(fk,"%8d",&kuc[kn]);
     }
     fclose(fk);
    gotoxy(55,8);
    int flag=0;
    statisticsone();
    statisticstwo();
    statisticsthree();
    struct buygoods*h,*t,*q;
    char x;
    printf("\t\t______________________________________\n");
    printf("\t\t|                                    |\n");
    printf("\t\t|        *输入1修改进货记录          |\n");
    printf("\t\t|        *输入2修改批发销售          |\n");
    printf("\t\t|        *输入3修改零售销售          |\n");
    printf("\t\t|_____________*按0返回_______________|\n");
    while(x!='1'&&x!='2'&&x!='3'&&x!='0')
    {
        x=getch();
    }
    if(x=='1')
    {
        h=readfileone();
        printf("\n*修改进货记录信息:\n");
    }
    else if(x=='2')
    {
        h=readfiletwo();
        printf("\n*修改批发销售信息:\n");
    }
    else if(x=='3')
    {
        h=readfilethree();
        printf("\n*修改零售销售信息:\n");
    }
    else if(x=='0')
    {
        return;
    }
    printf("\t\t_____________________________________________________\n");
    printf("\t\t|__________________修改信息_________________________|\n");
    printf("\t\t|___________________________________________________|\n");
    printf("\t\t*请输入要修改的时间:(如果寻找未知时间,按回车跳过)");
    char a[20],b[20],c[20],d[20];
    Time(a,b,c,d);
    for(t=h;t!=NULL;t=t->next)
    {
        if(strcmp(a,t->in.month)==0&&strcmp(b,t->in.day)==0&&strcmp(c,t->in.hour)==0&&strcmp(d,t->in.minute)==0)
        {
            printf("\n\t\t*已找到该条信息\n");
            flag=0;
            q=t;
            break;
        }
        else flag=1;
    }
    if(flag==1)  printf("\n\t\t*抱歉,未找到该信息");
    if(flag==0)
    {
        if(x=='1')
        {
            if(strcmp(q->name,"键盘")==0&&strcmp(q->type,"A型")==0) kuc[0]-=atoi(q->amount);
            else if(strcmp(q->name,"键盘")==0&&strcmp(q->type,"B型")==0) kuc[1]-=atoi(q->amount);
            else if(strcmp(q->name,"键盘")==0&&strcmp(q->type,"C型")==0) kuc[2]-=atoi(q->amount);
            else if(strcmp(q->name,"键盘")==0&&strcmp(q->type,"D型")==0) kuc[3]-=atoi(q->amount);
            else if(strcmp(q->name,"鼠标")==0&&strcmp(q->type,"A型")==0) kuc[4]-=atoi(q->amount);
            else if(strcmp(q->name,"鼠标")==0&&strcmp(q->type,"B型")==0) kuc[5]-=atoi(q->amount);
            else if(strcmp(q->name,"鼠标")==0&&strcmp(q->type,"C型")==0) kuc[6]-=atoi(q->amount);
            else if(strcmp(q->name,"鼠标")==0&&strcmp(q->type,"D型")==0) kuc[7]-=atoi(q->amount);
            else if(strcmp(q->name,"显卡")==0&&strcmp(q->type,"A型")==0) kuc[8]-=atoi(q->amount);
            else if(strcmp(q->name,"显卡")==0&&strcmp(q->type,"B型")==0) kuc[9]-=atoi(q->amount);
            else if(strcmp(q->name,"显卡")==0&&strcmp(q->type,"C型")==0) kuc[10]-=atoi(q->amount);
            else if(strcmp(q->name,"显卡")==0&&strcmp(q->type,"D型")==0) kuc[11]-=atoi(q->amount);
            else if(strcmp(q->name,"移动硬盘")==0&&strcmp(q->type,"A型")==0) kuc[12]-=atoi(q->amount);
            else if(strcmp(q->name,"移动硬盘")==0&&strcmp(q->type,"B型")==0) kuc[13]-=atoi(q->amount);
            else if(strcmp(q->name,"移动硬盘")==0&&strcmp(q->type,"C型")==0) kuc[14]-=atoi(q->amount);
            else if(strcmp(q->name,"移动硬盘")==0&&strcmp(q->type,"D型")==0) kuc[15]-=atoi(q->amount);
        }
        if(x=='2'||x=='3')
        {
            if(strcmp(q->name,"键盘")==0&&strcmp(q->type,"A型")==0) kuc[0]+=atoi(q->amount);
            else if(strcmp(q->name,"键盘")==0&&strcmp(q->type,"B型")==0) kuc[1]+=atoi(q->amount);
            else if(strcmp(q->name,"键盘")==0&&strcmp(q->type,"C型")==0) kuc[2]+=atoi(q->amount);
            else if(strcmp(q->name,"键盘")==0&&strcmp(q->type,"D型")==0) kuc[3]+=atoi(q->amount);
            else if(strcmp(q->name,"鼠标")==0&&strcmp(q->type,"A型")==0) kuc[4]+=atoi(q->amount);
            else if(strcmp(q->name,"鼠标")==0&&strcmp(q->type,"B型")==0) kuc[5]+=atoi(q->amount);
            else if(strcmp(q->name,"鼠标")==0&&strcmp(q->type,"C型")==0) kuc[6]+=atoi(q->amount);
            else if(strcmp(q->name,"鼠标")==0&&strcmp(q->type,"D型")==0) kuc[7]+=atoi(q->amount);
            else if(strcmp(q->name,"显卡")==0&&strcmp(q->type,"A型")==0) kuc[8]+=atoi(q->amount);
            else if(strcmp(q->name,"显卡")==0&&strcmp(q->type,"B型")==0) kuc[9]+=atoi(q->amount);
            else if(strcmp(q->name,"显卡")==0&&strcmp(q->type,"C型")==0) kuc[10]+=atoi(q->amount);
            else if(strcmp(q->name,"显卡")==0&&strcmp(q->type,"D型")==0) kuc[11]+=atoi(q->amount);
            else if(strcmp(q->name,"移动硬盘")==0&&strcmp(q->type,"A型")==0) kuc[12]+=atoi(q->amount);
            else if(strcmp(q->name,"移动硬盘")==0&&strcmp(q->type,"B型")==0) kuc[13]+=atoi(q->amount);
            else if(strcmp(q->name,"移动硬盘")==0&&strcmp(q->type,"C型")==0) kuc[14]+=atoi(q->amount);
            else if(strcmp(q->name,"移动硬盘")==0&&strcmp(q->type,"D型")==0) kuc[15]+=atoi(q->amount);
        }
        printf("\t\t*该信息如下:\n");
        printf("\t\t*时间为:%s月%s日%s时%s分\n",t->in.month,t->in.day,t->in.hour,t->in.minute);
        printf("\t\t*配件名称为:%s\n",t->name);
        printf("\t\t*配件型号为:%s\n",t->type);
        printf("\t\t*制造商为:%s\n",t->creat);
        if(x=='1')
        {
            printf("\t\t*单价为:%s\n",t->unitprice);
        }
        else if(x=='2')
        {
            printf("\t\t*批发单价为:%s\n",t->unitprice);
        }
        else if(x=='3')
        {
            printf("\t\t*零售单价为:%s\n",t->unitprice);
        }
        printf("\t\t*数量为:%s\n",t->amount);
        printf("\t\t*总价为:%s\n",t->totalprice);
        if(x=='1')
        {
            printf("\t\t*供货商为:%s\n",t->supplier);
        }
        else
        {
            printf("\t\t*客户信息为:%s\n",t->supplier);
        }
        printf("\t\t*该记录已退账,请重新输入该信息:\n");
        printf("\n\t\t*请输入时间(如果时间未知,按回车跳过):");  Time(t->in.month,t->in.day,t->in.hour,t->in.minute);
        surplus(t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice);

        if(x=='1')
        {
            printf("\n\n\t\t*请输入供货商:");  gets(t->supplier);jd(t->supplier);
            lengthc=strlen(t->supplier); n1=lengthc;
            while(flag1==0)
          {
             flag1=1;
             for(n=0;nsupplier[n]==' ')
                 {
                    n1--;
                    flag1=0;
                    break;
                 }
             }
             if(n1!=lengthc)
             {
                  printf("\n\t\t*输入不合理,请重新输入(不能包含空格)");
                  printf("\n\n\t\t*请输入供货商:");  gets(t->supplier);jd1(t->supplier);
                  lengthc=strlen(t->supplier);n1=lengthc;
             }
           if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"A型")==0) kuc[0]+=atoi(t->amount);
           else if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"B型")==0) kuc[1]+=atoi(t->amount);
           else if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"C型")==0) kuc[2]+=atoi(t->amount);
           else if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"D型")==0) kuc[3]+=atoi(t->amount);
           else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"A型")==0) kuc[4]+=atoi(t->amount);
           else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"B型")==0) kuc[5]+=atoi(t->amount);
           else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"C型")==0) kuc[6]+=atoi(t->amount);
           else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"D型")==0) kuc[7]+=atoi(t->amount);
           else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"A型")==0) kuc[8]+=atoi(t->amount);
           else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"B型")==0) kuc[9]+=atoi(t->amount);
           else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"C型")==0) kuc[10]+=atoi(t->amount);
           else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"D型")==0) kuc[11]+=atoi(t->amount);
           else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"A型")==0) kuc[12]+=atoi(t->amount);
           else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"B型")==0) kuc[13]+=atoi(t->amount);
           else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"C型")==0) kuc[14]+=atoi(t->amount);
           else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"D型")==0) kuc[15]+=atoi(t->amount);

        }
        if(x=='2'||x=='3')
        {
            printf("\n\n\t\t*请输入客户信息:");  gets(t->supplier);jd(t->supplier);
            lengthc=strlen(t->supplier); n1=lengthc;
            while(flag1==0)
          {
             flag1=1;
             for(n=0;nsupplier[n]==' ')
                 {
                    n1--;
                    flag1=0;
                    break;
                 }
             }
             if(n1!=lengthc)
             {
                  printf("\n\t\t*输入不合理,请重新输入(不能包含空格)");
                  printf("\n\n\t\t*请输入客户:");  gets(t->supplier);jd1(t->supplier);
                  lengthc=strlen(t->supplier);n1=lengthc;
             }
           if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"A型")==0) kuc[0]-=atoi(t->amount);
           else if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"B型")==0) kuc[1]-=atoi(t->amount);
           else if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"C型")==0) kuc[2]-=atoi(t->amount);
           else if(strcmp(t->name,"键盘")==0&&strcmp(t->type,"D型")==0) kuc[3]-=atoi(t->amount);
           else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"A型")==0) kuc[4]-=atoi(t->amount);
           else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"B型")==0) kuc[5]-=atoi(t->amount);
           else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"C型")==0) kuc[6]-=atoi(t->amount);
           else if(strcmp(t->name,"鼠标")==0&&strcmp(t->type,"D型")==0) kuc[7]-=atoi(t->amount);
           else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"A型")==0) kuc[8]-=atoi(t->amount);
           else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"B型")==0) kuc[9]-=atoi(t->amount);
           else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"C型")==0) kuc[10]-=atoi(t->amount);
           else if(strcmp(t->name,"显卡")==0&&strcmp(t->type,"D型")==0) kuc[11]-=atoi(t->amount);
           else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"A型")==0) kuc[12]-=atoi(t->amount);
           else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"B型")==0) kuc[13]-=atoi(t->amount);
           else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"C型")==0) kuc[14]-=atoi(t->amount);
           else if(strcmp(t->name,"移动硬盘")==0&&strcmp(t->type,"D型")==0) kuc[15]-=atoi(t->amount);
        }
        printf("\n\t\t*该条信息已修改\n");
    }
        }
    if(x=='1')  writefileone(h);
    else if(x=='2')  writefiletwo(h);
    else if(x=='3')  writefilethree(h);
    fk=fopen("计算机配件库存数量信息.txt","w");
    fclose(fk);
    fk=fopen("计算机配件库存数量信息.txt","a+");
    for(kn=0; kn<16; kn++)
    {
        fprintf(fk,"%8d",kuc[kn]);
    }
    fclose(fk);
    printf("\n\t\t*按任意键返回");
    getch();
}
}

//删除函数
void Delete(){
    int flag=0;
    money();
    gotoxy(55,8);
    int kuc[16],kn;
    FILE *fk;
    if((fk=fopen("计算机配件库存数量信息.txt","r"))==NULL)
    {
       printf("\t\t文件出错,按任意键退出!");
       getch();
       exit(1);
     }
     for(kn=0;kn<16;kn++)
     {
         fscanf(fk,"%8d",&kuc[kn]);
     }
     fclose(fk);
    statisticsone();
    statisticstwo();
    statisticsthree();
    struct buygoods*h,*t,*p,*k,*q;
    char x;
    printf("\t\t______________________________________\n");
    printf("\t\t|                                    |\n");
    printf("\t\t|        *输入1删除进货记录          |\n");
    printf("\t\t|        *输入2删除批发销售          |\n");
    printf("\t\t|        *输入3删除零售销售          |\n");
    printf("\t\t|_____________*按0返回_______________|\n");
    while(x!='1'&&x!='2'&&x!='3'&&x!='0')
    {
        x=getch();
    }
    if(x=='1')
    {
        h=readfileone();
        printf("\n\t\t删除进货配件信息:");
    }
    else if(x=='2')
    {
        h=readfiletwo();
        printf("\n\t\t删除批发配件信息:");
    }
    else if(x=='3')
    {
        h=readfilethree();
        printf("\n\t\t删除零售配件信息:");
    }
    else if(x=='0')
    {
        return;
    }
    printf("\n\t\t|_____________________________________________________________|\n");
    printf("\t\t|____________________删除配件信息_____________________________|\n");
    printf("\t\t|_____________________________________________________________|\n");
    printf("\t\t请输入要删除的信息的时间(如果删除未知时间,按回车跳过):");
    char a[20],b[20],c[20],d[20];
    Time(a,b,c,d);
    p=h;
    for(t=h;t!=NULL;t=t->next)
    {
        if(strcmp(a,t->in.month)==0&&strcmp(b,t->in.day)==0&&strcmp(c,t->in.hour)==0&&strcmp(d,t->in.minute)==0)
        {
            printf("\n\t*已找到该条信息\n");
            flag=0;
            q=t;
            break;
        }
        else
        {
            flag=1;
        }
    }
    if(flag==1)
    {
        printf("\n\t*抱歉,未找到该条信息\n");
    }
    if(flag==0)
    {
        if(strcmp(q->name,"键盘")==0&&strcmp(q->type,"A型")==0) kuc[0]-=atoi(q->amount);
        else if(strcmp(q->name,"键盘")==0&&strcmp(q->type,"B型")==0) kuc[1]-=atoi(q->amount);
        else if(strcmp(q->name,"键盘")==0&&strcmp(q->type,"C型")==0) kuc[2]-=atoi(q->amount);
        else if(strcmp(q->name,"键盘")==0&&strcmp(q->type,"D型")==0) kuc[3]-=atoi(q->amount);
        else if(strcmp(q->name,"鼠标")==0&&strcmp(q->type,"A型")==0) kuc[4]-=atoi(q->amount);
        else if(strcmp(q->name,"鼠标")==0&&strcmp(q->type,"B型")==0) kuc[5]-=atoi(q->amount);
        else if(strcmp(q->name,"鼠标")==0&&strcmp(q->type,"C型")==0) kuc[6]-=atoi(q->amount);
        else if(strcmp(q->name,"鼠标")==0&&strcmp(q->type,"D型")==0) kuc[7]-=atoi(q->amount);
        else if(strcmp(q->name,"显卡")==0&&strcmp(q->type,"A型")==0) kuc[8]-=atoi(q->amount);
        else if(strcmp(q->name,"显卡")==0&&strcmp(q->type,"B型")==0) kuc[9]-=atoi(q->amount);
        else if(strcmp(q->name,"显卡")==0&&strcmp(q->type,"C型")==0) kuc[10]-=atoi(q->amount);
        else if(strcmp(q->name,"显卡")==0&&strcmp(q->type,"D型")==0) kuc[11]-=atoi(q->amount);
        else if(strcmp(q->name,"移动硬盘")==0&&strcmp(q->type,"A型")==0) kuc[12]-=atoi(q->amount);
        else if(strcmp(q->name,"移动硬盘")==0&&strcmp(q->type,"B型")==0) kuc[13]-=atoi(q->amount);
        else if(strcmp(q->name,"移动硬盘")==0&&strcmp(q->type,"C型")==0) kuc[14]-=atoi(q->amount);
        else if(strcmp(q->name,"移动硬盘")==0&&strcmp(q->type,"D型")==0) kuc[15]-=atoi(q->amount);

        if(strcmp(a,h->in.month)==0&&strcmp(b,h->in.day)==0&&strcmp(c,h->in.hour)==0&&strcmp(d,h->in.minute)==0)
        {
            h=h->next;
        }
        else
        {
            while((strcmp(a,p->in.month)!=0||strcmp(b,p->in.day)!=0||strcmp(c,p->in.hour)!=0||strcmp(d,p->in.minute)!=0) && p->next!=NULL)
            {
                k=p;
                p=p->next;
            }
            if(strcmp(a,p->in.month)==0&&strcmp(b,p->in.day)==0&&strcmp(c,p->in.hour)==0&&strcmp(d,p->in.minute)==0)
            {
                k->next=p->next;
            }
            printf("\n\t*该配件信息已删除\n");
        }
    }
    if(x=='1')  writefileone(h);
    else if(x=='2')  writefiletwo(h);
    else if(x=='3')  writefilethree(h);
    fk=fopen("计算机配件库存数量信息.txt","w");
    fclose(fk);
    fk=fopen("计算机配件库存数量信息.txt","a+");
    for(kn=0; kn<16; kn++)
    {
        fprintf(fk,"%8d",kuc[kn]);
    }
    fclose(fk);
    printf("\n\t*按任意键返回");
    getch();
}

//统计营业额、盈利额————生成目前的库存报表
void queryone(){
    money();
    gotoxy(55,8);
    statisticsone();
    statisticstwo();
    statisticsthree();
    printf("\n\t\t*按任意键返回");
    getch();
}

//统计进货记录函数
void statisticsone(){
    struct buygoods*phead,*t;
    phead=readfileone();
    printf("\n");
    printf("\t\t-----------------------------------进货记录信息--------------------------------------------\n");
    printf("\n\n\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n","月","日","时","分","配件名称","配件型号","制造商","零售单价","数量","总价","客户信息");
    printf("\t\t--------------------------------------------------------------------------------------------\n");
    for(t=phead->next;t!=NULL;t=t->next)
    {
        printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
    }
}

//统计批发销售函数
void statisticstwo(){
    struct buygoods*h,*t;
    h=readfiletwo();
    printf("\n");
    printf("\t\t-------------------------------------批发销售信息--------------------------------------------\n");
    printf("\n\n\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n","月","日","时","分","配件名称","配件型号","制造商","零售单价","数量","总价","客户信息");
    printf("\t\t--------------------------------------------------------------------------------------------\n");
    for(t=h->next;t!=NULL;t=t->next)
    {
        printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
    }
}

//统计零售销售函数
void statisticsthree(){
    struct buygoods*h,*t;
    h=readfilethree();
    printf("\n");
    printf("\t\t-------------------------------------零售销售信息--------------------------------------------\n");
    printf("\n\n\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n","月","日","时","分","配件名称","配件型号","制造商","零售单价","数量","总价","客户信息");
    printf("\t\t--------------------------------------------------------------------------------------------\n");
    for(t=h->next;t!=NULL;t=t->next)
    {
        printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
    }
}

//统计批发赠品函数
void statisticsfour(){
    struct giftgoods *h,*t;
    FILE *f;
    int n;
    int b[10];
    if((f=fopen("计算机配件赠品数量信息.txt","r"))==NULL)
    {
        printf("\t\t文件出错,按任意键退出!");
        getch();
        exit(1);
    }
    printf("\n\n\n");
    printf("\n\t\t-----------------------------------------现存库存信息--------------------------------------------------------------");
    printf("\n\t\t%10s%10s%10s%10s%10s%10s%10s%10s%10s%10s\n","无线键盘","无线鼠标","16G内容条","低配显卡","8GU盘","16G磁盘","光驱","降温风扇","无线网卡","蓝牙音响");
    printf("\n\t\t-----------------------------------------------------------------------------------------------------------------\n");
    for(n=0; n<10; n++)
    {
        fscanf(f,"%2d",&b[n]);
    }
    printf("\n\t\t");
    for(n=0; n<10; n++)
    {
        printf("%10d",b[n]);
    }
    fclose(f);
    f=fopen("计算机配件赠品数量信息.txt","w");
    fclose(f);
    f=fopen("计算机配件赠品数量信息.txt","a+");
    for(n=0; n<10; n++)
    {
        fprintf(f,"%2d",b[n]);
    }
    fclose(f);;
    h=readfilefour();
    printf("\n\n\n\n\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s%10s\n","月","日","时","分","配件名称","配件型号","制造商","零售单价","数量","总价","客户信息","赠品种类");
    printf("\t\t-----------------------------------------------------------------------------------------------------\n");
    for(t=h->next;t!=NULL;t=t->next)
    {
        printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s%10s",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier,t->present);
        printf("\n");
    }
    printf("*按任意键返回.");
    getch();
}

//按照时间顺序生成目前的库存报表
void querytwo(){
    struct buygoods *h,*t,*p,*q;
    money();
    gotoxy(55,8);
    h=readfileone();
    char tname[20];
    for(p=h->next;p->next!=NULL;p=p->next)
    {
        for(q=p->next;q!=NULL;q=q->next)
        {
            if((strcmp(q->in.month,p->in.month)<0)||((strcmp(q->in.month,p->in.month)==0)&&(strcmp(q->in.day,p->in.day)<0))||((strcmp(q->in.month,p->in.month)==0)&&(strcmp(q->in.day,p->in.day)==0)&&(strcmp(q->in.hour,p->in.hour)<0))
               ||((strcmp(q->in.month,p->in.month)==0)&&(strcmp(q->in.day,p->in.day)==0)&&(strcmp(q->in.hour,p->in.hour)==0)&&(strcmp(q->in.minute,p->in.minute))))
            {
                strcpy(tname,p->in.month);
                strcpy(p->in.month,q->in.month);
                strcpy(q->in.month,tname);

                strcpy(tname,p->in.day);
                strcpy(p->in.day,q->in.day);
                strcpy(q->in.day,tname);

                strcpy(tname,p->in.hour);
                strcpy(p->in.hour,q->in.hour);
                strcpy(q->in.hour,tname);

                strcpy(tname,p->in.minute);
                strcpy(p->in.minute,q->in.minute);
                strcpy(q->in.minute,tname);

                strcpy(tname,p->name);
                strcpy(p->name,q->name);
                strcpy(q->name,tname);

                strcpy(tname,p->type);
                strcpy(p->type,q->type);
                strcpy(q->type,tname);

                strcpy(tname,p->creat);
                strcpy(p->creat,q->creat);
                strcpy(q->creat,tname);

                strcpy(tname,p->unitprice);
                strcpy(p->unitprice,q->unitprice);
                strcpy(q->unitprice,tname);

                strcpy(tname,p->amount);
                strcpy(p->amount,q->amount);
                strcpy(q->amount,tname);

                strcpy(tname,p->totalprice);
                strcpy(p->totalprice,q->totalprice);
                strcpy(q->totalprice,tname);

                strcpy(tname,p->supplier);
                strcpy(p->supplier,q->supplier);
                strcpy(q->supplier,tname);
            }
        }
    }
    printf("\n\n");
    printf("\t\t-----------------------------------进货记录信息----------------------------------------\n");
    printf("\t\t%20s%10s%10s%10s%10s%10s%10s%10s\n","时间","配件名称","配件型号","制造商","单价","数量","总价","供货商");
    printf("\t\t--------------------------------------------------------------------------------------------\n");
    for(t=h->next->next;t!=NULL;t=t->next)
    {
        printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
        printf("\n");
    }

    h=readfiletwo();
    for(p=h->next;p->next!=NULL;p=p->next)
    {
        for(q=p->next;q!=NULL;q=q->next)
        {
            if((strcmp(q->in.month,p->in.month)<0)||((strcmp(q->in.month,p->in.month)==0)&&(strcmp(q->in.day,p->in.day)<0))||((strcmp(q->in.month,p->in.month)==0)&&(strcmp(q->in.day,p->in.day)==0)&&(strcmp(q->in.hour,p->in.hour)<0))
               ||((strcmp(q->in.month,p->in.month)==0)&&(strcmp(q->in.day,p->in.day)==0)&&(strcmp(q->in.hour,p->in.hour)==0)&&(strcmp(q->in.minute,p->in.minute))))
            {
                strcpy(tname,p->in.month);
                strcpy(p->in.month,q->in.month);
                strcpy(q->in.month,tname);

                strcpy(tname,p->in.day);
                strcpy(p->in.day,q->in.day);
                strcpy(q->in.day,tname);

                strcpy(tname,p->in.hour);
                strcpy(p->in.hour,q->in.hour);
                strcpy(q->in.hour,tname);

                strcpy(tname,p->in.minute);
                strcpy(p->in.minute,q->in.minute);
                strcpy(q->in.minute,tname);

                strcpy(tname,p->name);
                strcpy(p->name,q->name);
                strcpy(q->name,tname);

                strcpy(tname,p->type);
                strcpy(p->type,q->type);
                strcpy(q->type,tname);

                strcpy(tname,p->creat);
                strcpy(p->creat,q->creat);
                strcpy(q->creat,tname);

                strcpy(tname,p->unitprice);
                strcpy(p->unitprice,q->unitprice);
                strcpy(q->unitprice,tname);

                strcpy(tname,p->amount);
                strcpy(p->amount,q->amount);
                strcpy(q->amount,tname);

                strcpy(tname,p->totalprice);
                strcpy(p->totalprice,q->totalprice);
                strcpy(q->totalprice,tname);

                strcpy(tname,p->supplier);
                strcpy(p->supplier,q->supplier);
                strcpy(q->supplier,tname);
            }
        }
    }
    printf("\n\n");
    printf("\t\t-----------------------------------批发销售信息----------------------------------------\n");
    printf("\t\t%20s%10s%10s%10s%10s%10s%10s%10s\n","时间","配件名称","配件型号","制造商","单价","数量","总价","供货商");
    printf("\t\t--------------------------------------------------------------------------------------------\n");
    for(t=h->next->next;t!=NULL;t=t->next)
    {
        printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
    }

    h=readfilethree();
    for(p=h->next;p->next!=NULL;p=p->next)
    {
        for(q=p->next;q!=NULL;q=q->next)
        {
            if((strcmp(q->in.month,p->in.month)<0)||((strcmp(q->in.month,p->in.month)==0)&&(strcmp(q->in.day,p->in.day)<0))||((strcmp(q->in.month,p->in.month)==0)&&(strcmp(q->in.day,p->in.day)==0)&&(strcmp(q->in.hour,p->in.hour)<0))
               ||((strcmp(q->in.month,p->in.month)==0)&&(strcmp(q->in.day,p->in.day)==0)&&(strcmp(q->in.hour,p->in.hour)==0)&&(strcmp(q->in.minute,p->in.minute))))
            {
                strcpy(tname,p->in.month);
                strcpy(p->in.month,q->in.month);
                strcpy(q->in.month,tname);

                strcpy(tname,p->in.day);
                strcpy(p->in.day,q->in.day);
                strcpy(q->in.day,tname);

                strcpy(tname,p->in.hour);
                strcpy(p->in.hour,q->in.hour);
                strcpy(q->in.hour,tname);

                strcpy(tname,p->in.minute);
                strcpy(p->in.minute,q->in.minute);
                strcpy(q->in.minute,tname);

                strcpy(tname,p->name);
                strcpy(p->name,q->name);
                strcpy(q->name,tname);

                strcpy(tname,p->type);
                strcpy(p->type,q->type);
                strcpy(q->type,tname);

                strcpy(tname,p->creat);
                strcpy(p->creat,q->creat);
                strcpy(q->creat,tname);

                strcpy(tname,p->unitprice);
                strcpy(p->unitprice,q->unitprice);
                strcpy(q->unitprice,tname);

                strcpy(tname,p->amount);
                strcpy(p->amount,q->amount);
                strcpy(q->amount,tname);

                strcpy(tname,p->totalprice);
                strcpy(p->totalprice,q->totalprice);
                strcpy(q->totalprice,tname);

                strcpy(tname,p->supplier);
                strcpy(p->supplier,q->supplier);
                strcpy(q->supplier,tname);
            }
        }
    }
    printf("\n");
    printf("\t\t-----------------------------------零食销售信息----------------------------------------\n");
    printf("\t\t%20s%10s%10s%10s%10s%10s%10s%10s\n","时间","配件名称","配件型号","制造商","单价","数量","总价","供货商");
    printf("\t\t--------------------------------------------------------------------------------------------\n");
    for(t=h->next->next;t!=NULL;t=t->next)
    {
        printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
    }

    printf("\n\t\t*按任意键返回");
    getch();
}

//查询函数
void choice(){
    gotoxy(55,8);
    char n;
    do
    {
        switch(menutwo())
        {
            case 1:
                choiceone();
                break;
            case 2:
                choicetwo();
                break;
            case 3:
                choicethree();
                break;
        }
        printf("\n\n\t*继续输入请按Y,退出请按N:");
        n=getch();
        while(n!='Y'&&n!='N')
        {
             n=getch();
        }
    }while(n=='Y');
    if(n=='N')
    return;
}

//选择菜单2
int menutwo(){
    char n;
    do{
        system("cls");
        money();
        printf("\t\t------------------------------计算机配件信息查询(按时间顺序)---------------------------------\n");
        printf("\n\t\t__________________________________________________\n");
        printf("\t\t|                                                |\n");
        printf("\t\t|   1.按照配件种类检索配件信息                   |\n");
        printf("\t\t|   2.按照供货商标识检索历史进货信息             |\n");
        printf("\t\t|   3.按照客户标识检索历史采购信息               |\n");
        printf("\t\t|                                                |\n");
        printf("\t\t|____________________按0退出_____________________|\n");
        printf("\t\t请选择0-3:");
        n=getch();
    }while(n<'0'||n>'3');
    return(n-48);
}

//排序配件函数
void  choiceone(){
    system("CLS");
    money();
    struct buygoods *h,*t;
    char a;
    gotoxy(55,2);
    printf("*-----------------------------计算机配件信息查询(按时间顺序)--------------------------------*\n");
    printf("\n");
    printf("\t\t_________________________________________\n");
    printf("\t\t|                                       |\n");
    printf("\t\t|        输入1打印配件进货信息          |\n");
    printf("\t\t|        输入2打印配件批发信息          |\n");
    printf("\t\t|        输入3打印配件零售信息          |\n");
    printf("\t\t|_______________________________________|\n");
    while(a!='1'&&a!='2'&&a!='3')
    {
        a=getch();
    }
    if(a=='1')
    {
        h=readfileone();
    }
    else if(a=='2')
    {
        h=readfiletwo();
    }
    else if(a=='3')
    {
        h=readfilethree();
    }
    printf("\t\t_____________________________________________________\n");
    printf("\t\t|______________查询配件信息信息_____________________|\n");
    printf("\t\t|___________________________________________________|\n");
    printf("\n\t\t |-----------------------------------------------|\n");
    printf("\n\t\t | 1.键盘     2.鼠标      3.显卡    4.移动硬盘   |\n");
    printf("\n\t\t |-----------------------------------------------|\n");
    printf("\n\t\t请选择配件名称(1-4):");
    char i;
    char name[20];
    do
    {
        i=getch();
        if(i=='1')   strcpy(name,"键盘");
        else if(i=='2')   strcpy(name,"鼠标");
        else if(i=='3')   strcpy(name,"显卡");
        else if(i=='4')   strcpy(name,"移动硬盘");
        else printf("\n\t\t输入格式错误,请重新输入!");
    }while(i<'1'||i>'4');
    int flag=0;
    for(t=h;t!=NULL;t=t->next)
    {
        if(strcmp(name,t->name)==0)
        {
            printf("\n\t\t已找到该信息\n");
            flag=0;
            break;
        }
        else flag=1;
    }
    if(flag==1)  printf("\t\t抱歉,未找到该信息");
    if(flag==0)
    {
        if(a=='1')
        {
            printf("\n");
            printf("\t\t%20s%10s%10s%10s%10s%10s%10s%10s\n","时间","配件名称","配件型号","制造商","单价","数量","总价","供货商");
            printf("\t\t--------------------------------------------------------------------------------------------\n");
            for(t=h->next;t!=NULL;t=t->next)
            {
                if(strcmp(name,t->name)==0)
                {
                    printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
                }
            }
        }
        if(a=='2')
        {
            printf("\n");
            printf("\t\t%20s%10s%10s%10s%10s%10s%10s%10s\n","时间","配件名称","配件型号","制造商","批发单价","数量","总价","客户信息");
            printf("\t\t--------------------------------------------------------------------------------------------\n");
            for(t=h->next;t!=NULL;t=t->next)
            {
                if(strcmp(name,t->name)==0)
                {
                    printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
                }
           }
        }
        if(a=='3')
        {
            printf("\n");
            printf("\t\t%20s%10s%10s%10s%10s%10s%10s%10s\n","时间","配件名称","配件型号","制造商","零售单价","数量","总价","客户信息");
            printf("\t\t--------------------------------------------------------------------------------------------\n");
            for(t=h->next;t!=NULL;t=t->next)
            {
                if(strcmp(name,t->name)==0)
                {
                    printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
                }
            }
        }
    }
}

//排序供货商函数
void  choicetwo(){
    system("CLS");
    money();
    gotoxy(55,2);
    printf("*-----------------------------计算机配件信息查询(按时间顺序)--------------------------------*\n");
    struct buygoods*h,*t;
    printf("\n");
    printf("\t\t_________________________________________\n");
    printf("\t\t|                                       |\n");
    printf("\t\t|           打印供货商进货信息          |\n");
    printf("\t\t|_______________________________________|\n");
    h=readfileone();
    printf("\n*请输入您要查询的供货商名称:");
    char name[20];
    scanf("%s",name);
    int flag=0;
    for(t=h;t!=NULL;t=t->next)
    {
        if(strcmp(name,t->supplier)==0)
        {
            printf("\n\t\t*已找到该信息\n");
            flag=0;
                break;
        }
        else flag=1;
    }
    if(flag==1)  printf("\t\t*抱歉,未找到该信息");
    if(flag==0)
    {
        char tname[20];
        printf("\n");
        printf("\t\t%20s%10s%10s%10s%10s%10s%10s%10s\n","时间","配件名称","配件型号","制造商","单价","数量","总价","供货商");
        printf("\t\t--------------------------------------------------------------------------------------------\n");
        for(t=h->next;t!=NULL;t=t->next)
        {
            if(strcmp(tname,t->supplier)==0)
            {
            printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
            }
        }
    }
    printf("\t\t\n*按任意键返回");
    getch();
}

//排序客户历史采购信息函数
void  choicethree(){
    system("CLS");
    money();
    struct buygoods*h,*t,*p;
    h=readfiletwo();
    gotoxy(55,2);
    printf("*-----------------------------计算机配件信息查询(按时间顺序)--------------------------------*\n");
    printf("\n");
    printf("\t\t_____________________________________________________\n");
    printf("\t\t|______________查询客户历史采购信息_________________|\n");
    printf("\t\t|___________________________________________________|\n");
    printf("请输入您要查询的客户名称:");
    char name[20];
    scanf("%s",name);
    int flag=0;
    for(t=h;t!=NULL;t=t->next)
    {
        if(strcmp(name,t->supplier)==0)
        {
            printf("\n\t\t已找到该信息\n");
            flag=0;
            break;
        }
        else flag=1;
    }
    if(flag==1)  printf("\t\t抱歉,未找到该信息");
    if(flag==0)
    {
        for(p=h->next;p->next!=NULL;p=p->next)
        {
            printf("\n");
            printf("\t\t------------------------------------该客户历史批发采购信息----------------------------------\n");
            printf("\t\t%20s%10s%10s%10s%10s%10s%10s%10s\n","时间","配件名称","配件型号","制造商","单价","数量","总价","客户信息");
            printf("\t\t--------------------------------------------------------------------------------------------\n");
            if(strcmp(name,t->supplier)==0)
            {
                printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
            }
        }
        h=readfilethree();
        for(p=h->next;p->next!=NULL;p=p->next)
        {
            printf("\n\n\n");
            printf("\t\t------------------------------------该客户历史零售采购信息----------------------------------\n");
            printf("\t\t%20s%10s%10s%10s%10s%10s%10s%10s\n","时间","配件名称","配件型号","制造商","单价","数量","总价","客户信息");
            printf("\t\t--------------------------------------------------------------------------------------------\n");
            if(strcmp(name,t->supplier)==0)
            {
                printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
            }
        }
    }
    printf("\t\t\n按任意键继续");
    getch();
}

//按照时间查询函数
void timequery(){
    struct buygoods *head,*t;
    money();
    char x;
    printf("\n");
    printf("\t\t______________________________________\n");
    printf("\t\t|                                    |\n");
    printf("\t\t|        *输入1查询进货记录时间段    |\n");
    printf("\t\t|        *输入2查询批发销售时间段    |\n");
    printf("\t\t|        *输入3查询零售销售时间段    |\n");
    printf("\t\t|_____________*按0返回_______________|\n");
    while(x!='1'&&x!='2'&&x!='3'&&x!='0')
    {
        x=getch();
    }
    if(x=='1')
    {
        head=readfileone();
        printf("\n\t\t*查询进货记录时间段:\n");
    }
    else if(x=='2')
    {
        head=readfiletwo();
        printf("\n\t\t*查询批发销售时间段:\n");
    }
    else if(x=='3')
    {
        head=readfilethree();
        printf("\n\t\t*查询零售销售时间段:\n");
    }
    else if(x=='0')
    {
        return;
    }
    char a[20],b[20],c[20],d[20],e[20],f[20],g[20],h[20];
    printf("\n\t\t*请输入想要查找的开始时间(时间未知,按回车键跳过):");
    Time(a,b,c,d);
    printf("\n\t\t*请输入想要查找的结束时间(时间未知,按回车键跳过):");
    Time(e,f,g,h);
    int flag=0;
    for(t=head->next;t!=NULL;t=t->next)
    {
        if(
           ((strcmp(t->in.month,a)>0)&&(strcmp(t->in.month,e)<0))
           ||((strcmp(t->in.month,a)==0)&&(strcmp(t->in.day,b)>0))||((strcmp(t->in.month,a)==0)&&(strcmp(t->in.day,b)==0)&&(strcmp(t->in.hour,c)>0))
           ||((strcmp(t->in.month,a)==0)&&(strcmp(t->in.day,b)==0)&&(strcmp(t->in.hour,c)==0)&&(strcmp(t->in.minute,d)>=0))
           ||((strcmp(t->in.month,e)==0)&&(strcmp(t->in.day,f)<0))||((strcmp(t->in.month,e)==0)&&(strcmp(t->in.day,f)==0)&&(strcmp(t->in.hour,g)<0))
           ||((strcmp(t->in.month,e)==0)&&(strcmp(t->in.day,f)==0)&&(strcmp(t->in.hour,g)==0)&&(strcmp(t->in.minute,h)<=0))
           )
        {
            printf("\n\t\t*已找到所查询时间段\n");
            flag=0;
            break;
        }
        else
        flag=1;
    }
    if(flag==1)  printf("\t\t*抱歉,未找到所查询信息");
    if(flag==0)
    {
        if(x=='1')
        {
            printf("\n");
            printf("\t\t-----------------------------------进货记录时间段----------------------------------------\n");
            printf("\t\t%20s%10s%10s%10s%10s%10s%10s%10s\n","进货时间","配件名称","配件型号","制造商","批发单价","数量","总价","供货商");
            printf("\t\t--------------------------------------------------------------------------------------------\n");
            for(t=head->next;t!=NULL;t=t->next)
            {
             if(
                 ((strcmp(t->in.month,a)>0)&&(strcmp(t->in.month,e)<0))
                 ||((strcmp(t->in.month,a)==0)&&(strcmp(t->in.day,b)>0))||((strcmp(t->in.month,a)==0)&&(strcmp(t->in.day,b)==0)&&(strcmp(t->in.hour,c)>0))
                 ||((strcmp(t->in.month,a)==0)&&(strcmp(t->in.day,b)==0)&&(strcmp(t->in.hour,c)==0)&&(strcmp(t->in.minute,d)>=0))
                 ||((strcmp(t->in.month,e)==0)&&(strcmp(t->in.day,f)<0))||((strcmp(t->in.month,e)==0)&&(strcmp(t->in.day,f)==0)&&(strcmp(t->in.hour,g)<0))
                 ||((strcmp(t->in.month,e)==0)&&(strcmp(t->in.day,f)==0)&&(strcmp(t->in.hour,g)==0)&&(strcmp(t->in.minute,h)<=0))
               )
                printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
            }
        }
        else  if(x=='2')
        {
            printf("\n");
            printf("\t\t-----------------------------------批发销售时间段----------------------------------------\n");
            printf("\t\t%20s%10s%10s%10s%10s%10s%10s%10s\n","时间","配件名称","配件型号","制造商","批发单价","数量","总价","客户信息");
            printf("\t\t--------------------------------------------------------------------------------------------\n");
            for(t=head->next;t!=NULL;t=t->next)
            {
             if(
                 ((strcmp(t->in.month,a)>0)&&(strcmp(t->in.month,e)<0))
                 ||((strcmp(t->in.month,a)==0)&&(strcmp(t->in.day,b)>0))||((strcmp(t->in.month,a)==0)&&(strcmp(t->in.day,b)==0)&&(strcmp(t->in.hour,c)>0))
                 ||((strcmp(t->in.month,a)==0)&&(strcmp(t->in.day,b)==0)&&(strcmp(t->in.hour,c)==0)&&(strcmp(t->in.minute,d)>=0))
                 ||((strcmp(t->in.month,e)==0)&&(strcmp(t->in.day,f)<0))||((strcmp(t->in.month,e)==0)&&(strcmp(t->in.day,f)==0)&&(strcmp(t->in.hour,g)<0))
                 ||((strcmp(t->in.month,e)==0)&&(strcmp(t->in.day,f)==0)&&(strcmp(t->in.hour,g)==0)&&(strcmp(t->in.minute,h)<=0))
               )
                printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
            }
        }
        else if(x=='3')
        {
            printf("\n");
            printf("\t\t-----------------------------------零售销售时间段----------------------------------------\n");
            printf("\t\t%20s%10s%10s%10s%10s%10s%10s%10s\n","时间","配件名称","配件型号","制造商","零售单价","数量","总价","客户信息");
            printf("\t\t--------------------------------------------------------------------------------------------\n");
            for(t=head->next;t!=NULL;t=t->next)
            {
             if(
                 ((strcmp(t->in.month,a)>0)&&(strcmp(t->in.month,e)<0))
                 ||((strcmp(t->in.month,a)==0)&&(strcmp(t->in.day,b)>0))||((strcmp(t->in.month,a)==0)&&(strcmp(t->in.day,b)==0)&&(strcmp(t->in.hour,c)>0))
                 ||((strcmp(t->in.month,a)==0)&&(strcmp(t->in.day,b)==0)&&(strcmp(t->in.hour,c)==0)&&(strcmp(t->in.minute,d)>=0))
                 ||((strcmp(t->in.month,e)==0)&&(strcmp(t->in.day,f)<0))||((strcmp(t->in.month,e)==0)&&(strcmp(t->in.day,f)==0)&&(strcmp(t->in.hour,g)<0))
                 ||((strcmp(t->in.month,e)==0)&&(strcmp(t->in.day,f)==0)&&(strcmp(t->in.hour,g)==0)&&(strcmp(t->in.minute,h)<=0))
               )
                printf("\t\t%5s%5s%5s%5s%10s%10s%10s%10s%10s%10s%10s\n",t->in.month,t->in.day,t->in.hour,t->in.minute,t->name,t->type,t->creat,t->unitprice,t->amount,t->totalprice,t->supplier);
            }
        }
    }

    printf("\t\t\n*按任意键返回");
    getch();
}

//结束页面
void end(){
    system("cls");
    gotoxy(60,12);
    puts("---------------------------------------------------------------");
    gotoxy(60,15);
    puts("-------------------------感谢您的使用!------------------------");
    gotoxy(60,18);
    puts("---------------------------------------------------------------");
    gotoxy(80,22);
    exit(1);
}


接下来是程序运行过程截图

C语言用链表实现管理系统_第2张图片
C语言用链表实现管理系统_第3张图片
C语言用链表实现管理系统_第4张图片
C语言用链表实现管理系统_第5张图片
C语言用链表实现管理系统_第6张图片
C语言用链表实现管理系统_第7张图片
C语言用链表实现管理系统_第8张图片
C语言用链表实现管理系统_第9张图片
C语言用链表实现管理系统_第10张图片
在这里插入图片描述
C语言用链表实现管理系统_第11张图片
C语言用链表实现管理系统_第12张图片
C语言用链表实现管理系统_第13张图片
C语言用链表实现管理系统_第14张图片
提醒:截图没有把此程序的全部功能体现出来,有些功能需要自己切实操作才能完美体现。

总结
忙了一个多月,学的东西也基本用上了,只要链表,文件会的话,写一个简单的管理系统也是比较简单的,希望对大家有帮助,本人也要学新东西了(但只要有时间就会对这个程序修改完善,关注我的Blog,后续会陆续发表相关信息)。其实还有很多功能自己没写,比如多端登陆,多线程运行,图形界面,弹窗提醒等等,跟别人的差距还是蛮大的。

补:上传文件有些麻烦,我就直接把样本文件直接写出来吧
首先:txt文件的名字一定要对
C语言用链表实现管理系统_第15张图片
计算机配件进货记录信息
未知 01 02 03 键盘 D型 靠课 80 20 1600.00 偶课
04 08 05 06 鼠标 A型 厉害 50 50 2500.00 偶喷
07 08 09 04 移动硬盘 D型 王健林 50 77 3850.00 阿里巴巴
02 02 04 09 显卡 C型 王健林 120 66 7920.00 马云
04 04 04 04 鼠标 B型 王健林 60 33 1980.00 王思聪
04 08 09 06 键盘 A型 阿里巴巴 70 80 5600.00 搜狐

计算机配件库存数量信息
80 -40 0 20 50 33 0 0 0 0 66 0 0 0 0 77

计算机配件零售销售信息
(空白即可)

计算机配件批发销售信息
04 02 01 03 键盘 B型 黄何 60 40 2400.00 刘老板

计算机配件批发赠品信息
(空白即可)

计算机配件赠品数量信息
5 4 4 5 4 4 0 5 5 5

你可能感兴趣的:(C语言)