资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

出库函数c语言 C语言中库函数

C语言高手帮忙编一个仓库物资管理系统

#include stdafx.h

创新互联公司凭借在网站建设、网站推广领域领先的技术能力和多年的行业经验,为客户提供超值的营销型网站建设服务,我们始终认为:好的营销型网站就是好的业务员。我们已成功为企业单位、个人等客户提供了网站建设、成都做网站服务,以良好的商业信誉,完善的服务及深厚的技术力量处于同行领先地位。

#includestdio.h

#includestring.h

#define SIZE 2//SIZE为仓库电器种类

struct goods

{

char name[10];

char brand[10];

char style[10];

int num;

float money;

}stu[SIZE];//库存结构

struct date

{

int year;

int month;

int day;

};//日期结构

struct entrance

{

char name[10];

char brand[10];

char style[10];

int num;

float money;

struct date time;

char stuf[10];

}stu_2[SIZE];//入库结构

struct exit

{

char name[10];

char brand[10];

char style[10];

int num;

struct date time;

char stuf[10];

}stu_3[SIZE];//出库结构

void main()

{

void save_1();

void save_2();

void save_3();

void change_1();

void change_2();

void found_1();

void found_2();

int i;

printf("please input the information:\n");

for(i=0;iSIZE;i++)

{

scanf("%s%s%s%d%d",stu[i].name,stu[i].brand,stu[i].style,stu[i].num,stu[i].money);

} //输入库存

save_1(); //利用函数将库存保存

FILE *fp;

fp=fopen("stu_list.txt","rb");

for(i=0;iSIZE;i++)

{

fread(stu[i],sizeof(struct goods),1,fp);

printf("%s %s %s %d %d",stu[i].name,stu[i].brand,stu[i].style,stu[i].num,stu[i].money);

printf("\n");

} //读出信息

fclose(fp);

printf("请输入物资入库信息:\n");//输入入库信息

for(i=0;iSIZE;i++)

scanf("%s%s%s%d%f%d%d%d%s",stu_2[i].name,stu_2[i].brand,stu_2[i].style,stu_2[i].num,stu_2[i].money,stu_2[i].time.year,stu_2[i].time.month,stu_2[i].time.day,stu_2[i].stuf);

save_2(); //创建入库文件

change_1();

printf("请输入出库信息\n");

scanf("%s%s%s%d%d%d%d%s",stu_3[i].name,stu_3[i].brand,stu_3[i].style,stu_3[i].num,stu_3[i].time.year,stu_3[i].time.month,stu_3[i].time.day,stu_3[i].stuf);

for(i=0;iSIZE;i++)

{

if(stu_3[i].numstu[i].num)

{

printf("the error number!please input again!\n");

break;

}

else

{

save_3();

change_2();

}

}

found_1();

found_2();

}

void save_1()

{

FILE *fp;

int i;

if((fp=fopen("stu_list.txt","wb"))==NULL)

{

printf("connot open the file\n");

return;

}

for(i=0;iSIZE;i++)

{

if(fwrite(stu[i],sizeof(struct goods),1,fp)!=1)

printf("file write error\n");

}

fclose(fp);

}

void save_2()

{

FILE *fp;

int i;

if((fp=fopen("stu_list_2.txt","wb"))==NULL)

{

printf("connot open the file\n");

return;

}

for(i=0;iSIZE;i++)

{

if(fwrite(stu_2[i],sizeof(struct entrance),1,fp)!=1)

printf("file write error\n");

}

fclose(fp);

}

void change_1()

{

int i;

for(i=0;iSIZE;i++)

{

if(strcmp(stu[i].name,stu_2[i].name)==0strcmp(stu[i].brand,stu_2[i].brand)==0strcmp(stu[i].style,stu_2[i].style)==0)

{

stu[i].num=stu[i].num+stu_2[i].num;

}

}

save_1();

}

void save_3()

{

FILE *fp;

int i;

if((fp=fopen("stu_list_3.txt","wb"))==NULL)

{

printf("connot open the file\n");

return;

}

for(i=0;iSIZE;i++)

{

if(fwrite(stu_3[i],sizeof(struct exit),1,fp)!=1)

printf("file write error\n");

}

fclose(fp);

}

void change_2()

{

int i;

for(i=0;iSIZE;i++)

{

if(strcmp(stu[i].name,stu_3[i].name)==0strcmp(stu[i].brand,stu_3[i].brand)==0strcmp(stu[i].style,stu_3[i].style)==0)

{

stu[i].num=stu[i].num-stu_3[i].num;

}

}

save_1();

}

void found_1()

{

FILE *fp;

int i;

int sum=0;

char name[10];

char brand[10];

printf("please input the name and brand:\n");//4.1 4.2 5.1

scanf("%s%s",name,brand);

if((fp=fopen("stu.list.txt","rb"))==NULL)

{

printf("connot open the file!\n");

return;

}

for(i=0;iSIZE;i++)

{

if(fread(stu[i],sizeof(struct goods),1,fp)!=1)

{

if(strcmp(name[10],stu[i].name[10])==0)

{

printf("the information of the good:\n");

printf("%s %s %s %d %d",stu[i].name,stu[i].brand,stu[i].style,stu[i].num,stu[i].money);

sum=sum+stu[i].num;

}

if(strcmp(brand[10],stu[i].brand[10])==0)

{

printf("the information of the good:\n");

printf("%s %s %s %d %d",stu[i].name,stu[i].brand,stu[i].style,stu[i].num,stu[i].money);

}

}

}

printf("the number of this %s is %d.\n",name[10],sum);

}

void found_2()

{

FILE *fp;

int i;

int j;

int sum=0;

int year_1,year_2,month_1,month_2,day_1;

char name_1[10],name_2[10],style_1[10];

if((fp=fopen("stu_list_2.txt","rb"))==NULL)

{

printf("connot open the file!\n");

return;

}

if((fp=fopen("stu_list_3.txt","rb"))==NULL)

{

printf("connot open the file!\n");

return;

}

printf("please input year_1,month_1,day_1,then find the exit and entrance:\n");

scanf("%d%d%d",year_1,month_1,day_1);

printf("please input the name and style,then find the good's entrance and exit");

scanf("%s%s",name_1,style_1);

printf("please input the name of the good,then output the number or its entrance:\n");

scanf("%s",name_2);

printf("please input year_2 and month_2,then output the number of exit in this month:\n");

scanf("%d%d",year_2,month_2);

printf("please input the red number,then output all the informations of the goods:\n");

scanf("%d",j);

for(i=0;iSIZE;i++)

{

if((fread(stu_2[i],sizeof(struct entrance),1,fp)!=1)(fread(stu_3[i],sizeof(struct exit),1,fp)!=1))//读出入库和出库信息

{

if((stu_2[i].time.year==year_1)(stu_2[i].time.month==month_1)(stu_2[i].time.day==day_1))//入库信息4.3

{

printf("%s%s%s%d%f%d%d%d%s",stu_2[i].name,stu_2[i].brand,stu_2[i].style,stu_2[i].num,stu_2[i].money,stu_2[i].time.year,stu_2[i].time.month,stu_2[i].time.day,stu_2[i].stuf);

}

if((stu_3[i].time.year==year_1)(stu_3[i].time.month==month_1)(stu_3[i].time.day==day_1))//出库信息4.3

{

printf("%s%s%s%d%d%d%d%s",stu_3[i].name,stu_3[i].brand,stu_3[i].style,stu_3[i].num,stu_3[i].time.year,stu_3[i].time.month,stu_3[i].time.day,stu_3[i].stuf);

}

}

}

for(i=0;iSIZE;i++)//4.4

{

if((fread(stu_2[i],sizeof(struct entrance),1,fp)!=1)(fread(stu_3[i],sizeof(struct exit),1,fp)!=1))//读出入库和出库信息

{

if((strcmp(stu_2[i].name,name_1))==0(strcmp(stu_2[i].style,style_1))==0)

{

printf("%s%s%s%d%f%d%d%d%s",stu_2[i].name,stu_2[i].brand,stu_2[i].style,stu_2[i].num,stu_2[i].money,stu_2[i].time.year,stu_2[i].time.month,stu_2[i].time.day,stu_2[i].stuf);

}

if((strcmp(stu_3[i].name,name_1))==0(strcmp(stu_3[i].style,style_1))==0)

{

printf("%s%s%s%d%d%d%d%s",stu_3[i].name,stu_3[i].brand,stu_3[i].style,stu_3[i].num,stu_3[i].time.year,stu_3[i].time.month,stu_3[i].time.day,stu_3[i].stuf);

}

}

}

for(i=0;iSIZE;i++)//5.3

{

if((fread(stu_3[i],sizeof(struct exit),1,fp)!=1))

if(stu_3[i].time.year==year_2stu_3[i].time.month==month_2)

{

sum=sum+stu_3[i].num;

}

}

printf("the time of exit is %d.\n",sum);

for(i=0;iSIZE;i++)

{

if((fread(stu[i],sizeof(struct goods),1,fp)!=1))

{

if(stu[i].numj)

{

printf("th information of the good are:\n");

printf("%s%s%s%d%f",stu[i].name,stu[i].brand,stu[i].style,stu[i].num,stu[i].money);

}

}

}

}

一个表里一个入库两个出库怎么用函数

1.先在同一工作簿中作: 库存汇总、入库、出库 三个表格。 2.在库存汇总表中输入数据 然后选中型号列,将型号列设置为型号输入唯一性(避免重复统计): 1)数据有效性——设置:自定义——公式:=COUNTIF(B:B,B1)=1。 2)出错警告——停止。 3.在库存汇总表中设置公式 A3单元格中输入此公式: =IF(B3="","",1) A4单元格中输入此公式:=IF(B4="","",A3+1) E3单元格中输入此公式: =IF(B3="","",SUM(D3+F3-G3)) F3单元格中输入此公式: =IF(B3="","",SUMIF(入库! C:C,B3,入库! E:E)) G3单元格中输入此公式: =IF(B3="","",SUMIF(出库! C:C,B3,出库! E:E)) 然后将上行的公式复制到下面的行。 4.在入库表中输入数据,设置公式 A3单元格中输入此公式: =IF(B3="","",1) A4单元格中输入此公式:=IF(B4="","",A3+1) D3单元格中输入此公式:=IF(C3="","",

=SUMIF(出库记录!C:C,A51,出库记录!G:G)是什么意思? 其各自代表的含义是?

从出库记录工作表的C列找出与当前工作表A51匹配的行,将这些行对应的出库记录工作表中G列的值进行求和。SUMIF表示条件求和,是一个函数;第一个参数出库记录!C:C是要进行比较的区域,第二个参数A51是与第一个参数进行比较的值,第三人参数出库记录!G:G是要求和的区域,如果没有第三个参数,就对第一个参数进行求和。

产品出库管理系统C语言编程

系统结构

图1 RFID仓储管理系统结构图

RFID仓储管理系统由业务管理软件、RFID标签发行系统和RFID标签识别采集系统组成,这几个系统互相联系,共同完成物品管理的各个流程。后台数据库管理系统是整个系统的核心,RFID识别采集是实现管理功能的基础和手段。

后台管理软件由中心数据服务器和管理终端组成,是系统的数据中心。负责与手持机通讯,将手持机上传的数据转换并插入到后台业务仓储管理系统的数据库中,对标签管理信息、发行标签和采集的标签信息集中进行储存和处理。

RFID标签发行系统由电子标签专用打印机和标签制作管理软件组成,负责完成库位标签、物品标签、箱标签的信息写入和标签表面信息打印工作。

电子标签专用打印机采用内嵌非接触读写器的工业级热转印打印机,能够在标签芯片写入信息的同时在标签表面打印预先设定的内容信息。标签制作管理软件的核心是标签制作函数动态连接库,它嵌入在后台系统内,为后台仓储管理系统提供操作打印机制作标签的开发接口函数。基于该动态库还提供了一个独立的标签制作软件,可以手工输入标签数据,便于临时制作标签。

RFID标签识别采集系统可通过手持机或固定位置终端采集标签信息,完成标签数据的存储,并通过RFID中间件与管理中心进行数据的交换。

系统功能

本系统利用电子标签对每一个需要管理的对象在其管理周期内进行标记管理。管理人员利用本系统可以实时了解掌控每个被管理对象(物品)的性质、状态、位置、历史变化等信息,并根据这些信息采取相应的管理对策和措施,达到提高使用单位的运营水平和管理质量的目的。可以广泛用于军队、铁路、医疗卫生、烟草、电信等行业企事业单位的仓储管理。

根据需求,系统包含了若干模块:系统管理、标签制作、入库管理、出库管理、盘点管理、调拨管理、退换管理、报表分析、终端数据采集程序。

系统管理:系统设置以及系统用户信息和权限。

标签制作:依据入库单及标签制作申请单录入的货物信息生成每个物品的电子标签,在标签表面上打印标签序号及产品名称、型号规格,在芯片内记录产品的详细信息。

入库管理:入库时,仓库管理员根据订货清单清点检查每一件货品,检查合格后交给仓库保管员送入库房。仓库保管员持手持机扫描货架库位标签和入库物品上的标签并输入物品数量进行入库登记,数据记入手持机内的入库操作数据表,然后将物品放置到指定库位上。

如果需要将物品装入包装箱内存放,还需要扫描箱标签以更新手持机内箱明细表。

全部物品入库完毕后,将手持机交给管理员,由管理员将入库数据导入后台管理数据库内,完成入库操作。

经过这一流程后,仓库中每一种物品的位置、数量、规格型号等都可以在仓储管理软件中一目了然的查找出来,实现了仓储状态的可视化。

出库管理:出库时,仓库管理员根据根据领料申请查询仓储状态,然后做出预出库单;保管员根据预出库单将指定库位的物品取出,使用手持机扫描库位标签和物品标签将出库信息进行登记,数据记入手持机出库数据表;全部出库物品取出后将出库信息上传到主机,与预出库单作比较,并根据实出数量进行登帐。

盘点管理:使用手持数据采集终端进行数据的采集,如物品标签、摆放货架、物品数量等。系统可根据事先设定的产品分类,自动产生或人工选择产生盘点任务表,进行盘点作业,盘点作业主要扫描产品标签和相应的库位信息。数据上传后,系统会自动列出已盘产品与未盘产品,并根据需求进行盘盈、盘亏等操作。

调拨管理:出现调拨情况时,根据调拨情况选择不同的调拨流程。

退换货管理:客户退货的时候,通过读取产品标签可以查询的该产品是否是属于此客户,销售时间等信息,并且方便查询当时的销售信息,进行有效的监督和管理。对于确认需要退货的产品,手持机在读取标签时会将当前时间写入标签中的退货时间字段。

报表分析:对系统的数据进行统计分析,生成相关报表。

 

linux c动态库调用,进入库函数后,打印出库函数中的一句话,然后中止掉了Absorted

第一步,我先从简单的调用出发,定义了一个简单的函数,该函数仅仅实现一个整数加法求和:

LIBEXPORT_API int mySum(int a,int b){ return a+b;}

C# 导入定义:

public class RefComm

{

[DllImport("LibEncrypt.dll",

EntryPoint=" mySum ",

CharSet=CharSet.Auto,CallingConvention=CallingConvention.StdCall)]

public static extern int mySum (int a,int b);

}

在C#中调用测试:

int iSum = RefComm.mySum(,);

运行查看结果iSum为5,调用正确。第一步试验完成,说明在C#中能够调用自定义的动态链接库函数。

第二步,我定义了字符串操作的函数(简单起见,还是采用前面的函数名),返回结果为字符串:

LIBEXPORT_API char *mySum(char *a,char *b){sprintf(b,"%s",a); return a;}

C# 导入定义:

public class RefComm

{

[DllImport("LibEncrypt.dll",

EntryPoint=" mySum ",

CharSet=CharSet.Auto,

CallingConvention=CallingConvention.StdCall)]

public static extern string mySum (string a, string b);

}

在C#中调用测试:

string strDest="";

string strTmp= RefComm.mySum("45", strDest);

运行查看结果 strTmp 为"45",但是strDest为空。我修改动态链接库实现,返回结果为串b:

LIBEXPORT_API char *mySum(char *a,char *b){sprintf(b,"%s",a) return b;}

修改 C# 导入定义,将串b修改为ref方式:

public class RefComm

{

[DllImport("LibEncrypt.dll",

EntryPoint=" mySum ",

CharSet=CharSet.Auto,CallingConvention=CallingConvention.StdCall)]

public static extern string mySum (string a, ref string b);

}

在C#中再调用测试:

string strDest="";

string strTmp= RefComm.mySum("45", ref strDest);

运行查看结果 strTmp 和 strDest 均不对,含不可见字符。再修改 C# 导入定义,将CharSet从Auto修改为Ansi:

public class RefComm

{

[DllImport("LibEncrypt.dll",

EntryPoint=" mySum ",

CharSet=CharSet.Ansi,CallingConvention=CallingConvention.StdCall)]

public static extern string mySum (string a, string b);

}

在C#中再调用测试:

string strDest="";

string strTmp= RefComm. mySum("45", ref strDest);

运行查看结果 strTmp 为"45",但是串 strDest 没有赋值。第二步实现函数返回串,但是在函数出口参数中没能进行输出。再次修改 C# 导入定义,将串b修改为引用(ref):

public class RefComm

{

[DllImport("LibEncrypt.dll",

EntryPoint=" mySum ",

CharSet=CharSet.Ansi,CallingConvention=CallingConvention.StdCall)]

public static extern string mySum (string a, ref string b);

}

运行时调用失败,不能继续执行。

第三步,修改动态链接库实现,将b修改为双重指针:

LIBEXPORT_API char *mySum(char *a,char **b){sprintf((*b),"%s",a); return *b;}

C#导入定义:

public class RefComm

{

[DllImport("LibEncrypt.dll",

EntryPoint=" mySum ",

CharSet=CharSet.Ansi,CallingConvention=CallingConvention.StdCall)]

public static extern string mySum (string a, ref string b);

}

在C#中调用测试:

string strDest="";

string strTmp= RefComm. mySum("45", ref strDest);

运行查看结果 strTmp 和 strDest 均为"45",调用正确。第三步实现了函数出口参数正确输出结果。

第四步,修改动态链接库实现,实现整数参数的输出:

LIBEXPORT_API int mySum(int a,int b,int *c){ *c=a+b; return *c;}

C#导入的定义:

public class RefComm

{

[DllImport("LibEncrypt.dll",

EntryPoint=" mySum ",

CharSet=CharSet.Ansi,CallingConvention=CallingConvention.StdCall)]

public static extern int mySum (int a, int b,ref int c);

}

在C#中调用测试:

int c=0;

int iSum= RefComm. mySum(,, ref c);

运行查看结果iSum 和c均为5,调用正确。

经过以上几个步骤的试验,基本掌握了如何定义动态库函数以及如何在 C# 定义导入,有此基础,很快我实现了变长加密函数在 C# 中的调用,至此目标实现。

三、结论

在 C# 中调用 C++ 编写的动态链接库函数,如果需要出口参数输出,则需要使用指针,对于字符串,则需要使用双重指针,对于 C# 的导入定义,则需要使用引用(ref)定义。

对于函数返回值,C# 导入定义和 C++ 动态库函数声明定义需要保持一致,否则会出现函数调用失败。定义导入时,一定注意 CharSet 和 CallingConvention 参数,否则导致调用失败或结果异常。运行时,动态链接库放在 C# 程序的目录下即可,我这里是一个 C# 的动态链接库,两个动态链接库就在同一个目录下运行。

C语言写一个仓库管理系统

#includestdio.h#includestdlib.h#includestring.h#includemalloc.h#define max 32int ifempty=0;//标志,判断链表是无否为空typedef struct dnode /* 定义双向链表结构体 */ {int number; /* 货物编号 */char name[max]; /* 货物名称 */ int counter; /* 货物数量 */struct dnode *prior, *next;/* 定义两指针,分别指向其前驱和后继 */}dlnode; dlnode *create(dlnode *L);dlnode *input(dlnode *L);dlnode *output(dlnode *L);dlnode * outnum(dlnode *L);dlnode * outname(dlnode *L);dlnode *current(dlnode *L);void search(dlnode *L);void print(dlnode *L);void searchnum(dlnode *L);void searchname(dlnode *L);void display(dlnode *L) ;void main(){int x;dlnode *L;if(!(L=(dlnode *)malloc(sizeof(dlnode)))) //分配空间{printf("\n");exit(1);}create(L);///调用函数,创建头节点while(1){////////////////////////主菜单///////////////////////////printf(" ============================\n");printf(" 1. 货物出库和入库\n");printf(" 2. 查找货物表\n"); printf(" 3. 显示仓库货物表\n");printf(" 4. 输出到文件\n");printf(" 0. 退出\n");printf(" =============================\n");printf(" 选择0--3:");scanf("%d",x);switch(x){case 2:search(L);break;//调用查找函数case 1:current(L);break;//调用入库出库函数case 3:display(L);break;//调用显示输出函数case 4:print(L);break;//调用打印函数case 0:printf("\n bye!see you!\n");getchar();getchar();exit(0);//退出程序default:printf("\n Enter erreor!please input 0--4!"); getchar();getchar();}}}dlnode *create(dlnode *L)//创建链表头节点{printf(" 欢迎使用我的仓库管理系统");getchar(); ifempty=0;///////初始化头节点的值////////L-next=NULL;L-prior=NULL;L-number=L-counter=0;strcpy(L-name," "); return L;}void search(dlnode *L) ///查找的主要菜单{int y;if(ifempty==0){printf("没有输入货物!\n");getchar();getchar();return;}else{while(1){printf("=====================\n");printf("1.按编号查询\n");printf("2.按货物名称查询\n");printf("0.返回上一层\n");printf("====================\n");printf("选择0--2:");scanf("%d",y);switch(y){case 1:searchnum(L);break;//调用按编号查找的函数case 2:searchname(L);break;//调用按名称查找的函数case 0:return;//返回default:printf("enter error!Please input 0--2!\n\n");getchar();getchar();printf("\n\n");}}}}void searchnum(dlnode *L)///按编号查找的函数{int num,flag=0;//flag为是否找到的标志dlnode *head=L;if(ifempty==0){printf("没有货物被输入\n");getchar();getchar();return;}printf("输入你要查找的货物编号:\n");scanf("%d",num);while((L=L-next)!=head){if(L-number==num){ flag=1;//flag为1时表示找到printf("找到指定编号货物 \n"); printf("\n编号:%d\n",L-number);printf("名称:%s\n",L-name) ;printf("数量:%d\n\n",L-counter); } }if(flag==0)//flag为0时表示没有找到printf("没有找到指定编号货物,请查看是否还有货物。\n");getchar();getchar();}void searchname(dlnode *L)//按名称查找的函数{int flag=0;//flag为是否找到的标志char na[32];dlnode *head=L;if(ifempty==0){printf("没有货物被输入\n");getchar();getchar();return;}printf("输入你要查找的货物名称\n");scanf("%s",na);while((L=L-next)!=head){if(strcmp(L-name,na)==0){ flag=1;//flag为1时表示找到printf("找到指定名称货物 \n"); printf("\n编号:%d\n",L-number);printf("名称:%s\n",L-name) ;printf("数量:%d\n\n",L-counter); } }if(flag==0)//flag为0时表示没有找到printf("没有找到指定编号货物,请查看是否还有货物。\n\n");getchar();getchar();}dlnode *current(dlnode *L)//货物出库入库函数{int y;while(1){printf("========================\n");printf(" 1.货物入库\n");printf(" 2.货物出库\n");printf(" 0.返回上一层\n");printf("========================\n");printf(" 选择0--2:");scanf("%d",y);switch(y){case 1:input(L);break;//调用入库函数case 2:output(L);break;//调用出库函数case 0:return(L);//返回上一层default:printf("enter error!Please input 0--2!");getchar();getchar();printf("\n\n");}}}dlnode *input(dlnode *L)//定义入库函数{dlnode *in,*head;head=in=(dlnode *)malloc(sizeof(dlnode));//分配空间head=L;printf("\n请输入货物数据:\n");printf("编号:");scanf("%d",in-number);printf("名称:");scanf("%s",in-name);printf("数量:");scanf("%d",in-counter);if(L-next==NULL) //如果只有头节点,{ //把刚输入的in节点L-next=in; //跟在头节点后面L-prior=in; //in-next=L; //in-prior=L; //ifempty++; //ifempty加1}else{//如果当前L的下一个节点不是头节点while((L=L-next)!=head){//如果输入的数大于L-number,则插到L的前面if(L-numberin-number){in-next=L;in-prior=L-prior; L-prior-next=in;L-prior=in;ifempty++; //ifempty加1return(head);} }//输入的编号比其它编号都小,则插到最后个节点,并首尾相连head-prior-next=in;in-prior=head-prior;head-prior=in;in-next=head;ifempty++; //ifempty加1} return head;}dlnode *output(dlnode *L)//出库的函数{int y;dlnode *head=L;if(ifempty==0)//检测是否有货物输入{printf("没有货物输入系统\n");getchar();getchar();return(head);} while(1){printf("=============\n");printf("1.按编号出库\n");printf("2.按名称出库\n");printf("0.返回上一层\n");printf("==============\n");printf("选择0--2:");scanf("%d",y);switch(y){case 1:outnum(L);break;//调用按编号出库函数case 2:outname(L);break;//调用按名称出库函数case 0:return(L);default:printf("enter error!Please input 0--2!");getchar();getchar();printf("\n\n");}}} dlnode *outnum(dlnode *L)//按编号出库函数{ int num;dlnode *head=L;printf("请输入出库货物的编号:");scanf("%d",num);while((L=L-next)!=head){//如果找到就删除节点if(L-number==num){L-prior-next=L-next;L-next-prior=L-prior;ifempty--; //ifempty减1 printf("编号为%d的货物成功出库",num); getchar();getchar();return head; } }printf("没有此编号的货物,请查看是否还有货物。\n\n");getchar();getchar();return (head);}dlnode *outname(dlnode *L)//按名称出库函数{char na[32];dlnode *head=L;printf("请输入出库货物的名称:");scanf("%s",na);while((L=L-next)!=head){//如果找到就删除节点if(strcmp(L-name,na)==0){L-prior-next=L-next;L-next-prior=L-prior;ifempty--; //ifempty减1 printf("名称为%s的货物成功出库",na);getchar();getchar();return (head);}}printf("没有此名称的货物,请查看是否还有货物。\n\n");getchar();getchar();return(head);} void display(dlnode *L)//显示货物清单{dlnode *head=L;if(ifempty==0){printf("没有货物可显示\n");getchar();getchar();return;}L=L-next;do{ printf("\n编号:%d\n",L-number);printf("名称:%s\n",L-name) ;printf("数量:%d\n\n",L-counter);}while((L=L-next)!=head);getchar();getchar(); }void print(dlnode *L){dlnode *head=L;L=L-next;char filename[max];FILE *out;if(ifempty==0){printf("没有货物可输出\n");getchar();getchar();return;}printf("请输入文件名称:");scanf("%s",filename);if((out=fopen(filename,"w"))==NULL){printf("打开文件失败!\n");getchar();getchar();return;}do{ fprintf(out,"编号:%d\n名称:%s\n数量:%d\n\n",L-number,L-name,L-counter);}while((L=L-next)!=head);printf("输出成功\n");getchar();getchar();fclose(out);}


网页题目:出库函数c语言 C语言中库函数
标题来源:http://cdkjz.cn/article/hgocgi.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220