C——货物管理系统
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h> /*屏幕操作函数库*/ /*主管权限数据格式化*/
#define HEADER1_zg "-----------------------------货物管理系统(主管)--------------------------------\n"
#define HEADER2_zg "| 编号 | 名称 | 进价 | 售价 | 产地 | 生产日期 |保质期| 库存 | 销量 | 收入 |\n"
#define HEADER3_zg "|------|--------|------|------|------|----------|------|------|------|--------|\n"
#define FORMAT_zg "|%-6s|%-8s|%.2f |%.2f |%6s|%-4d%3d%3d| %4d | %4d | %4d |%.2f |\n"
#define DATA_zg p->data.numbs,p->data.name,p->data.purchase,p->data.sales,p->data.place,p->data.Date.year,p->data.Date.mouth,p->data.Date.day,p->data.days,p->data.stock,p->data.salesnumb,p->data.income
#define END_zg "-------------------------------------------------------------------------------\n" /*普通权限数据格式化*/
#define HEADER1_pt "----------------货物管理系统(普通)--------------------\n"
#define HEADER2_pt "| 编号 | 名称 | 售价 | 产地 | 生产日期 |保质期| 销量 |\n"
#define HEADER3_pt "|------|--------|------|------|----------|------|------|\n"
#define FORMAT_pt "|%-6s|%-8s| %.2f|%6s|%-4d%3d%3d| %4d | %4d |\n"
#define DATA_pt p->data.numbs,p->data.name,p->data.sales,p->data.place,p->data.Date.year,p->data.Date.mouth,p->data.Date.day,p->data.days,p->data.salesnumb
#define END_pt "--------------------------------------------------------\n" int yhflag=; /*是否优惠*/
int incomflag=; /*是否计算收入*/
int dateflag=; /*是否输入日期*/
int saveflag=; /*是否需要保存*/
char zg[]="zg";
char pt[]="pt"; struct date
{
int year;
int mouth;
int day;
}; /*货物基本信息*/
struct goods
{
char numbs[]; /*编号*/
char name[]; /*名称*/
float purchase; /*进价*/
float sales; /*售价*/
char place[]; /*产地*/
struct date Date; /*生产日期*/
int days; /*保质期*/
int datecha; /*保质期截止日期差*/
int stock; /*库存量*/
int salesnumb; /*销量*/
float income; /*收入*/
};
typedef struct node
{
struct goods data;
struct node *next;
}Node,*Link; /*格式化输出主管表头*/
void printheader_zg()
{
printf(HEADER1_zg);
printf(HEADER2_zg);
printf(HEADER3_zg);
}
/*格式化输出普通表头*/
void printheader_pt()
{
printf(HEADER1_pt);
printf(HEADER2_pt);
printf(HEADER3_pt);
}
/*格式化输出主管表中数据*/
void printdata_zg(Node *pp)
{
Node *p;
p=pp;
printf(FORMAT_zg,DATA_zg);
}
/*格式化输出普通表中数据*/
void printdata_pt(Node *pp)
{
Node *p;
p=pp;
printf(FORMAT_pt,DATA_pt);
}
/*输出案件错误信息*/
void wrong()
{
printf("\n\n\n\n*******错误:输入错误,按任意键继续*******\n");
getchar();
}
/*输出为查找到货物的信息*/
void Nofind()
{
printf("\n*****无此货物信息!*****\n");
getchar();
}
/*主管显示菜单*/
void Disp(Link L,char s[])
{
Node *p;
p=L->next;
if (!p) /*空,则*/
{
printf("\n没有录入货物信息\n");
getchar();
return ;
}
printf("\n\n");
if (strcmp(zg,s)==)
{
printheader_zg();
while (p)
{
printdata_zg(p);
p=p->next;
printf(HEADER3_zg);
}
}
else
{
printheader_pt();
while (p)
{
printdata_pt(p);
p=p->next;
printf(HEADER3_pt);
}
} getchar();
}
/*返回链表中符合要求的节点的指针,s[]保存用户查找内容,NaorNum[]保存按什么查找”name,num“*/
Node *Locate(Link L,char s[],char NaorNum[] )
{
Node *p;
if (strcmp(NaorNum,"num")==)
{
p=L->next;
while (p)
{
if (strcmp(p->data.numbs,s)==)
return p;
p=p->next;
}
}
else if (strcmp(NaorNum,"name")==)
{
p=L->next;
while (p)
{
if (strcmp(p->data.name,s)==)
return p;
p=p->next;
}
}
return ; /*未找到,返回空指针*/
}
/*平润年判断*/
int Year_pd(int year)
{
int flag;
if ((year%==&&year%!=)||year%==)
{/*闰年*/
flag=;
}
else
{/*平年*/
flag=;
}
return flag;
}
/*月份对应的天数*/
int Day_pd(int mouth,int flag)
{
int day;
switch(mouth)
{
case :
case :
case :
case :
case :
case :
case :day=;break;
case :
case :
case :
case :day=;break;
case :if (flag) day=;
else day=;break;
}
return day;
}
/*输入字符串,并进行验证,用户的输入通过*t输出*/
void S_input(char *t,int lens,char *notice)
{
char str[];
do
{
printf(notice);
scanf("%s",str);
if(strlen(str)>lens)
printf("\n超过了要求长度,重新输入\n");
} while (strlen(str)>lens);
strcpy(t,str);
} int Num_input(char *notice)
{
int a;
do
{
printf(notice);
scanf("%d",&a);
if(a<) printf("\n数字必须大于零\n");
} while (a<);
return a;
}
/*输入月份进行验证*/
int Mou_input(char *notice)
{
int mouth=;
do
{
printf(notice);
scanf("%d",&mouth);
if (mouth>||mouth<)
printf("\n月份必须在(1~12)之间!\n");
} while (mouth>||mouth<);
return mouth;
}
/*输入天数进行验证*/
int Day_input(char *notice,int year,int mouth)
{
int day=;
int nlimit,flag;
flag=Year_pd(year);
do
{
printf(notice);
scanf("%d",&day);
nlimit=Day_pd(mouth,flag);
if (day>nlimit||day<)
printf("\n日期必须在(1~%d)之间!\n",nlimit);
} while (day>nlimit||mouth<);
return day;
}
/*增加货物记录*/
void Add_goods(Link L)
{
Node *p,*r,*s;
char ch,flag=,num[];
r=L;
s=L->next;
system("cls");
Disp(L,zg);
while ()
{
while () /*输入编号,保证没有被使用,若输入为0,则推出*/
{
S_input(num,,"输入货物编号(按‘0’返回菜单界面):");
flag=;
if (strcmp(num,"")==) return;
s=L->next;
while (s) /*查询货物编号是否存在,若存在,要去输入新编号*/
{
if (strcmp(s->data.numbs,num)==)
{
flag=;
break;
}
s=s->next;
}
if (flag)
{
getchar();
printf("货物编号:%s已存在,是否要重新输入?(y/n)",num);
scanf("%c",&ch);
if(ch=='y'||ch=='Y')
continue;
else
return;
}
else
break;
}
p=(Node *)malloc(sizeof(Node));
if (!p)
{
printf("\n没有申请到");
return; /*返回到主界面*/
}
strcpy(p->data.numbs,num);
S_input(p->data.name,,"名称:");
p->data.purchase=Num_input("进价:");
p->data.sales=Num_input("售价:");
S_input(p->data.place,,"产地:");
p->data.Date.year=Num_input("成产日期:年:");
p->data.Date.mouth=Mou_input(" 月:");
p->data.Date.day=Day_input(" 日:",p->data.Date.year,p->data.Date.mouth);
p->data.days=Num_input("保质期(天):");
p->data.stock=Num_input("库存:");
p->data.salesnumb=Num_input("销量:");
p->data.income=;
p->next=r->next;
r->next=p; /*前插*/
}
return ;
}
int select(int a,int b) /*菜单选择*/
{
int n;
do
{
printf("\n\n");
printf("%15s"," ");
printf("请输入一个数(%d~%d): [ ]\b\b",a,b);
scanf("%d",&n);
} while (n<a||n>b);
return n;
}
/*实时计算实际收益*/
void Sum_Income(Link L)
{
Node *p;
p=L->next;
while (p)
{
p->data.income=p->data.salesnumb*(p->data.sales-p->data.purchase);
p=p->next;
}
incomflag=;
return ;
}
/*查询的通用方法*/
void Sea_by_ways(Link L,Node *p,char s[])
{
if (p)
{
if (strcmp(zg,s)==)
{
printheader_zg();
printdata_zg(p);
printf(END_zg);
printf("按任意键返回...");
getchar();
}
else
{
printheader_pt();
printdata_pt(p);
printf(END_pt);
printf("按任意键返回...");
getchar();
}
}
else
{
Nofind();
getchar();
}
}
/*按编号或货物名称查询*/
void Sea_by_name(Link L,char s[])
{
Node *p;
char ss[];
system("cls");
S_input(ss,,"请输入要查找的货物名称:");
p=Locate(L,ss,"name");
Sea_by_ways(L,p,s);
}
void Sea_by_num(Link L,char s[])
{
Node *p;
char ss[];
system("cls");
S_input(ss,,"请输入要查找的货物编号:");
p=Locate(L,ss,"num");
Sea_by_ways(L,p,s);
}
/*日期相对于本年的天数*/
int Sum_day(int year,int mouth,int day)
{
int i,flag,days,sum=;
flag=Year_pd(year);
for (i=;i<mouth;i++)
{
days=Day_pd(i,flag);
sum+=days;
}
return sum+day;
}
/*两个日期差值*/
void Datecha(Link L)
{
int year,mouth,day;
Node *p;
p=L->next;
year=Num_input("今天日期:年:");
mouth=Mou_input("月:");
day=Day_input("日:",year,mouth);
dateflag=;
if (!p)
{
printf("***无货物信息,不用输入日期***\n");
getchar();
return ;
}
else
{
while (p)
{
p->data.datecha=Sum_day(year,mouth,day)-Sum_day(p->data.Date.year,p->data.Date.mouth,p->data.Date.day);
p=p->next;
}
}
} void Dz_by_data( Link L)
{
Node *p,*r;
Link l;
int year,mouth,day,count=;
p=L->next;
l=(Node *)malloc(sizeof(Node));
l->next=NULL;
system("cls");
if (!dateflag)
{
Datecha(L);
}
printf("| 编号 | 名称 |过期差值|\n");
while (p)
{
printf("|%-6s|%-8s| %4d |",p->data.numbs,p->data.name,p->data.datecha);
if (p->data.days>=p->data.datecha)
{
/*优惠的标示优惠*/
if (p->data.days-p->data.datecha<=)
{
count++;
p->data.sales=p->data.sales/;
printf("已优惠\n");
/* Ltol(l,p,p->next);*/
}
else
{
printf("\n");
}
}
else
{
printf("该商品过期,请删除\n");
}
p=p->next;
} if(!count)
{
printf("/n***没有差10天过期的货物***/n");
getchar();
return;
}
else
{
printf("共有%d中商品打折",count);
yhflag=;
saveflag=;
Disp(L,zg);
}
}
/*删除*/
void Del_by_ways(Link L,Node *p)
{
Node *q;
char ch;
if (p)
{
q=L;
while(q->next!=p)
q=q->next;
printheader_zg();
printdata_zg(p);
printf(END_zg);
getchar();
printf("请确定是否要删除该货物信息(y/n):");
scanf("%c",&ch);
if (ch=='y'||ch=='Y')
{
q->next=p->next;
free(p);
printf("\n成功删除该货物信息\n");
saveflag=;
getchar();
return;
}
else
{
printf("\n没有删除该货物信息\n");
getchar();
return;
}
}
else
{
Nofind();
getchar();
}
}
/*通过名称删除*/
void Del_by_name(Link L)
{
Node *p;
char s[];
system("cls");
S_input(s,,"请输入要查删除的货物名称:");
p=Locate(L,s,"name");
Del_by_ways(L,p);
}
/*通过编号删除*/
void Del_by_num(Link L)
{
Node *p;
char s[];
system("cls");
S_input(s,,"请输入要查删除的货物的编号:");
p=Locate(L,s,"num");
Del_by_ways(L,p);
} /*补货信息*/
void Buhuo(Link L)
{
Node *p,*q;
int i=;
p=L->next;
system("cls");
if (p)
{
q=L->next;
printf("| 编号 | 名称 |库存|销量|剩余| \n");
while (q)
{
/*统计库存,销量,剩余*/
printf("|%-8s|%-8s|%-4d|%4d|%4d|\n",q->data.numbs,q->data.name,q->data.stock,q->data.salesnumb,q->data.stock-q->data.salesnumb);
q=q->next;
}
while (p)
{
if ((p->data.stock-p->data.salesnumb)<)
{
if (i==)
{
printf("需要补货的货物分别是\n");
printf("| 编号 |商品名称|\n");
}
printf("|%-8s|%8s|\n",p->data.numbs,p->data.name);
i++;
}
p=p->next;
}
if (i)
{
printf("共%d种货物\n",i);
getchar();
return;
}
else
{
printf("没有需要补充的货物种类\n");
getchar();
return;
}
}
else
{
printf("\n***没有货物信息***\n");
printf("\n按任意键返回...\n");
getchar();
return ;
}
} void Sort_by_ways(Link L,char s[],int n)
{
int flag=,a;
Node *p,*q,*lq,*fq; /*fq记下节点前驱,lq记下节点的后驱,q每次冒泡遍历,p控制遍历,qq用来交换地址*/
p=L->next;
system("cls");
while (p)
{
fq=L;
q=fq->next;
while (lq=q->next)
{
if (strcmp(zg,s)==)
{
switch (n)
{
case :a=strcmp(q->data.name,lq->data.name);break;
case :a=strcmp(q->data.numbs,lq->data.numbs);break;
case :a=(q->data.salesnumb>lq->data.salesnumb);break;
case :if(!incomflag) Sum_Income(L); a=(q->data.income>lq->data.income);break;
case :if (!dateflag) Datecha(L);a=(q->data.datecha>lq->data.datecha);break;
}
}
else
{
switch (n)
{
case :a=strcmp(q->data.name,lq->data.name);break;
case :a=strcmp(q->data.numbs,lq->data.numbs);break;
case :a=(q->data.sales>lq->data.sales);break;
case :a=(q->data.salesnumb>lq->data.salesnumb);break;
case :if (!dateflag) Datecha(L);a=(q->data.datecha>lq->data.datecha);break;
}
} /*if ((n==1)?(strcmp(q->data.name,lq->data.name)):(strcmp(q->data.numbs,q->data.numbs)))*/
if(a>)
{
flag=;
q->next=lq->next;
lq->next=q;
fq->next=lq;
}
fq=fq->next;
q=fq->next;
}
if(flag==) break;
p=p->next;
}
if (strcmp(zg,s)==)
Disp(L,zg);
else
Disp(L,pt);
} void Wb_Save(Link L)
{
FILE *out;
Node *p;
int count=;
if ((out=fopen("d:\\Goods.txt","w"))==NULL)
{
printf("打开文件失败!\n");
getchar();
return;
}
p=L->next;
fprintf(out,HEADER1_zg);
fprintf(out,HEADER2_zg);
fprintf(out,HEADER3_zg);
while (p)
{
fprintf(out,FORMAT_zg,DATA_zg);
p=p->next;
fprintf(out,HEADER3_zg);
count++;
}
if (count>)
{
getchar();
printf("\n\n\n***文本文件保存完成,共%d条货物信息保存***\n",count);
getchar();
saveflag=;
}
else
{
system("cls");
printf("没有货物信息,没有货物信息保存\n");
getchar();
}
fclose(out); /*关闭此文件*/
}
void Er_Save(Link L)
{
FILE *out;
Node *p;
int count=;
if ((out=fopen("d:\\Goods","wb"))==NULL)
{
printf("打开文件失败!\n");
getchar();
return;
}
p=L->next; while (p)
{
if (fwrite(p,sizeof(Node),,out))
{
p=p->next;
count++;
}
else
{
break;
}
}
if (count>)
{
getchar();
printf("\n\n\n***二进制文件保存完成,共%d条货物信息保存***\n",count);
getchar();
saveflag=;
}
else
{
system("cls");
printf("没有货物信息,没有货物信息保存\n");
getchar();
}
fclose(out); /*关闭此文件*/
}
void Menu_sort_zg()
{
system("cls");
printf("\n\n\n");
printf("%30s%s"," "," 排序货物信息 \n\n");
printf("%30s%s"," ","********功能*******\n\n");
printf("%30s%s"," ","* 1.按名称 *\n\n");
printf("%30s%s"," ","* 2.按编号 *\n\n");
printf("%30s%s"," ","* 3.按销量*\n\n");
printf("%30s%s"," ","* 4.按利润*\n\n");
printf("%30s%s"," ","* 5.按保期 *\n\n");
printf("%30s%s"," ","* 6.返回 *\n\n");
printf("%30s%s"," ","* 7.退出 *\n\n");
printf("%30s%s"," ","********************\n");
}
void Menu_sort_pt()
{
system("cls");
printf("\n\n\n");
printf("%30s%s"," "," 排序货物信息 \n\n");
printf("%30s%s"," ","********功能*******\n\n");
printf("%30s%s"," ","* 1.按名称 *\n\n");
printf("%30s%s"," ","* 2.按编号 *\n\n");
printf("%30s%s"," ","* 3.按售价 *\n\n");
printf("%30s%s"," ","* 4.按销量 *\n\n");
printf("%30s%s"," ","* 5.按保期 *\n\n");
printf("%30s%s"," ","* 6.返回 *\n\n");
printf("%30s%s"," ","* 7.退出 *\n\n");
printf("%30s%s"," ","********************\n");
}
void Menu_del()
{
system("cls");
printf("\n\n\n");
printf("%30s%s"," "," 删除货物信息 \n\n");
printf("%30s%s"," ","********功能*******\n\n");
printf("%30s%s"," ","* 1.按名称 *\n\n");
printf("%30s%s"," ","* 2.按编号 *\n\n");
printf("%30s%s"," ","* 3.返回 *\n\n");
printf("%30s%s"," ","* 4.退出 *\n\n");
printf("%30s%s"," ","********************\n");
}
void Menu_Sea()
{
system("cls");
printf("\n\n\n");
printf("%30s%s"," "," 查询货物信息 \n\n");
printf("%30s%s"," ","********功能*******\n\n");
printf("%30s%s"," ","* 1.按名称 *\n\n");
printf("%30s%s"," ","* 2.按编号 *\n\n");
printf("%30s%s"," ","* 3.返回 *\n\n");
printf("%30s%s"," ","* 4.退出 *\n\n");
printf("%30s%s"," ","********************\n");
}
void Menu_Qx() /*权限菜单*/
{
system("cls");
printf("\n\n\n");
printf("%25s%s"," "," 欢迎进入 \n");
printf("%25s%s"," "," 货物管理体统 \n\n\n");
printf("%25s%s"," ","**********功能*********\n\n");
printf("%25s%s"," ","* 1.主管 *\n\n");
printf("%25s%s"," ","* 2.普通用户 *\n\n");
printf("%25s%s"," ","* 3.退出 *\n\n");
printf("%25s%s"," ","***********************\n");
}
void Menu_zg() /*主管菜单*/
{
system("cls");
printf("\n\n\n");
printf("%15s%s"," "," 货物管理体统 \n\n\n");
printf("%15s%s"," ","*****************主管功能******************\n\n");
printf("%15s%s"," ","* 1.录入货物信息 *\n");
printf("%15s%s"," ","* 2.删除货物信息 *\n");
printf("%15s%s"," ","* 3.查找货物信息 *\n");
printf("%15s%s"," ","* 4.显示货物信息 *\n");
printf("%15s%s"," ","* 5.差10天过物信息(促销) *\n");
printf("%15s%s"," ","* 6.统计货物数量(补货) *\n");
printf("%15s%s"," ","* 7.实时收益 *\n");
printf("%15s%s"," ","* 9.排序日期差 *\n");
printf("%15s%s"," ","* 10.保存文件 *\n");
printf("%15s%s"," ","* 11.返回 *\n");
printf("%15s%s"," ","* 12.退出 *\n");
printf("%15s%s"," ","*******************************************\n");
}
void Menu_pt() /*普通菜单*/
{
printf("%15s%s"," "," 货物管理体统 \n\n\n");
printf("%15s%s"," ","*****************普通用户功能***************\n\n");
printf("%15s%s"," ","* 1.查找货物信息 *\n");
printf("%15s%s"," ","* 2.显示货物信息 *\n");
printf("%15s%s"," ","* 3.排序货物销量 *\n");
printf("%15s%s"," ","* 4.返回 *\n");
printf("%15s%s"," ","* 5.退出 *\n");
printf("%15s%s"," ","*************************************************\n");
}
void Isaveflag(Link L)
{
char ch;
if (saveflag)
{
printf("您已经修改数据了,是否要保存退出(y/n):");
getchar();
scanf("%c",&ch);
if (ch=='y'||ch=='Y')
{
Wb_Save(L);
Er_Save(L);
exit();
}
else
exit();
}
else
exit();
}
int IsPassword() /*密码是否通过*/
{
char password[];
char mypassword[]="";
static int n=;
int i;
system("cls");
for (;n>;n--)
{
switch(n)
{
case :
case : printf("密码错误,您还有%d次机会,请再输入:",n);break;
case : printf("请输入6位进入主管功能的密码:");getchar();break;
}
for ( i=;i<;i++)
{
password[i]=getch();
printf("*");
}
getchar();
password[]='\0';
if (strcmp(mypassword,password)==)
{
printf("***密码正确***");
getchar();
return ;
}
}
printf("恭喜你,三次都输错了,无法再输入密码,按任意键返回...");
getchar();
return ;
} void Sort_goods(Link L,char s[])
{
if (!L->next)
{
system("cls");
printf("\n没有货物信息,无法使用排序功能\n");
getchar();
return;
}
else
{
if (strcmp(zg,s)==)
{
system("cls");
for (;;)
{
Menu_sort_zg();
switch(select(,))
{
case :Sort_by_ways(L,zg,);break; /*名称*/
case :Sort_by_ways(L,zg,);break; /*编号*/
case :Sort_by_ways(L,zg,);break; /*销量*/
case :Sort_by_ways(L,zg,);break; /*利润*/
case :Sort_by_ways(L,zg,);break; /*保期*/
case :return;break;
case :Isaveflag(L);break;
}
getchar();
}
}
else
{
system("cls");
for (;;)
{
Menu_sort_pt();
switch(select(,))
{
case :Sort_by_ways(L,pt,);break; /*名称*/
case :Sort_by_ways(L,pt,);break; /*编号*/
case :Sort_by_ways(L,pt,);break; /*售价*/
case :Sort_by_ways(L,pt,);break; /*销量*/
case :Sort_by_ways(L,pt,);break; /*销量*/
case :return;break;
case :Isaveflag(L);break;
}
getchar();
}
}
}
}
void Sea_goods(Link L,char s[])
{
if (!L->next)
{
system("cls");
printf("\n***没有货物记录,不能进入查询功能***\n");
return ;
}
else
{
system("cls");
for (;;)
{
Menu_Sea();
switch(select(,))
{
case :Sea_by_name(L,s);break;
case :Sea_by_num(L,s);break;
case :return;break;
case :Isaveflag(L);break;
}
getchar();
}
}
}
void Del_goods(Link L)
{
if (!L->next)
{
system("cls");
printf("\n***没有货物记录,不能使用删除功能***\n");
return ;
}
else
{
system("cls");
for (;;)
{
Menu_del();
switch (select(,))
{
case :Del_by_name(L);break;
case :Del_by_num(L);break;
case :return;break;
case :Isaveflag(L);break;
}
getchar();
}
}
}
void main_zg(Link L) /*主管功能*/
{
system("cls");
for (;;)
{
Menu_zg();
switch (select(,))
{
case :Add_goods(L);saveflag=;break; /*增加货物信息*/
case :Del_goods(L);break; /*删除学生信息*/
case :Sea_goods(L,zg);break; /*按编号名字查询*/
case :system("cls");Disp(L,zg);break;
case :Dz_by_data(L);break;
case :Buhuo(L);break;
case :Disp(L,zg);Sum_Income(L);Disp(L,zg);break;
case :Sort_goods(L,zg);break;
case :Wb_Save(L);Er_Save(L);break;
case :return;break;
case :Isaveflag(L);break;
}
getchar();
}
}
void main_pt(Link L) /*普通功能*/
{
system("cls");
for (;;)
{
Menu_pt();
switch (select(,))
{
case :Sea_goods(L,pt);break; /*按编号名字查询*/
case :system("cls");Disp(L,pt);break;
case :Sort_goods(L,pt);break;
case :return;break;
case :Isaveflag(L);break;
}
getchar();
system("cls");
}
}
int main()
{
Link L;
FILE *in;
Node *p,*r;
int count=;
L=(Node *)malloc(sizeof(Node));
L->next=NULL;
r=L;
if ((in=fopen("d:\\Goods","ab+"))==NULL) /*以追加方式打开二进制文件*/
{
printf("\n***打开文件失败***\n");
exit();
}
while (!feof(in))
{
p=(Node *)malloc(sizeof(Node));
if (fread(p,sizeof(Node),,in))
{
p->next=r->next;
r->next=p;
count++;
}
}
fclose(in);
for (;;)
{
Menu_Qx();
switch (select(,))
{
case :if(IsPassword())
{
main_zg(L);
}
break;
case :main_pt(L);break;
case :Isaveflag(L);break;
}
getchar();
}
return ;
}
C——货物管理系统的更多相关文章
- 多用户商城系统 KgMall2.1公布
2014-5-28日,广州JUULUU公布多用户商城系统 KgMall2.1,kgMall是国内一款JAVA开源多用户版商城系统,新版KgMall更加模块化,juuluu团队重构了Kgcms的多个模块 ...
- THE BUG 队第一次团队作业
1.队名: THE BUG 队 2.队员学号: 杨梓琦 3118005115(队长) 温海源,3118005109 陈杰才,3118005089 李华,3118005097 钟明康,311800512 ...
- THE BUG 队第一次团队项目作业
队名: THE BUG 队 2.队员学号: 杨梓琦 3118005115(队长) 温海源,3118005109 陈杰才,3118005089 李华,3118005097 钟明康,3118005123 ...
- abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理一 (十九)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理二 (二十)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理三 (二十一)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理四 (二十二)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理五 (二十三)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- abp(net core)+easyui+efcore实现仓储管理系统——EasyUI之货物管理六(二十四)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
随机推荐
- Delphi XE7中新并行库
Delphi XE7中添加了新的并行库,和.NET的Task和Parellel相似度99%. 详细内容能够看以下的文章: http://www.delphifeeds.com/go/s/119574 ...
- 教你爱上Blocks(闭包)
传值 Blocks是C语言的扩充功能:带有自动变量(局部变量)的匿名函数.通过Blocks,源代码中就能使用匿名函数,即不带名称的函数.在我们 的工作中,命名占据了很大一部分,函数名,变量名,属性名, ...
- npoi 使用方法
不少朋友在做项目的过程中或多或少的都会用到excel导入.导出功能,下面我来给大家介绍一下使用NPOI如何导入.导出excel, 通过代码描述一下npoi的使用方法,希望都够给需要的朋友一点点帮助,也 ...
- Asp.net 获取服务器指定文件夹目录文件,并提供下载
string dirPath = HttpContext.Current.Server.MapPath("uploads/"); if (Directory.Exists(dirP ...
- Oracle中的Truncate和Delete语句
Oracle中的Truncate和Delete语句 首先讲一下,truncate命令: 语法:TRUNCATE TABLE table; 表格里的数据被清空,存储空间被释放. 运行后会自动 ...
- 如何调试框架中的app
1,在编写的app中添加断点,并重新生成或编译 2,找到框架app的相应位置代开文件把所用到的dll重新替换成上步生成的dll(bin->debug) 3,运行框架,在VS打开调试->附加 ...
- 创建XML文件
//创建XML文件 XmlDocument xmldoc = new XmlDocument(); XmlText xmltext; ...
- Android webViewj简单处理apk的下载链接
最近在开发二维码扫一扫的功能,需要分多种情况处理外部的url.遇到一个问题是,一些程序包(比如一些android应用)的下载不好处理.如果不做任何处理的话,webView会打开一个空白页.比如这个链接 ...
- 新视野OJ 2705 [SDOI2012]Longge的问题 (数论)
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2705 题解:求 sigma(gcd(i,n), 1<=i<=n<2^32) ...
- Python中初始化的问题以及注释问题
#coding=utf-8 # __author__ = 'minmin' from Tkinter import * #创建一个基于Frame的Application类 class Applicat ...