/***********************************************************
我的信息: *
姓名: 汪建林 生日:1985年2月26日 *
毕业学校: 2007年于成都理工大学 *
家乡地址: 四川渠县望溪乡包山村5组 *
联系QQ: 287307421 联系电话: 13558690869 *
联系Email: wangjianlin1985@126.com 287307421 *
双鱼林程序淘宝店: http://shop34864101.taobao.com *
双鱼林程序拍拍店: http://287307421.paipai.com *
网站: http://www.shuangyulin.com *
*
需要更多程序可以联系我,保证运行! *
***********************************************************/
#include<stdio.h>
#include "stdlib.h"
#include "string.h"
#define N 10
struct information
{
int num1;//入库编号//
int rklx;//入库类型//
int num2;//入库产品编号//
int sj1[3];//生产日期//
float dj;//入库产品单价//
int sl;//入库产品数量//
int num3;//仓库编号//
char name[10];//经办人//
int sj2[3];//入库日期//
};struct information inf[N];
/*******************************************************
功能:登陆函数,验证口令
参数:
参数1:password
类型:char []
说明:用户输入口令
返回值:1或0
类型:int
说明:1表示通过验证;0表示没有通过
*******************************************************/
int login(char password[])
{
static char key[10]="123";
if(strcmp(password,key)==0)
return 1;
else
return 0;
}
/*******************************************************
功能:从文件读信息到结构体数组中
参数:
参数1:information
类型:inf[]
说明:用来存储从文件读到的管理信息
返回值:i
类型:int
说明:表示实际读取到的个数
*******************************************************/
int readFromFile(struct information inf[])
{
FILE *fp=NULL;
int i=0;
fp=fopen("FILENAME.txt","rb"); /*打开文件*/
if(fp!=NULL)
{
while(!feof(fp)) /*从文件中读入学生*/
{
if(i>=N)
break;
if(fread(inf+i,sizeof(struct information),1,fp))
i++;
}
fclose(fp);
}
return i;
}
/*******************************************************
功能:结构体数组中的管理信息输出到文件
参数:
参数1:information
类型:inf[]
说明:用来存储从文件读到的管理信息
参数2:length
类型:int
说明:表示实际数组的长度
返回值:无
*******************************************************/
void writeToFile(struct information inf[],int length)
{
FILE *fp=NULL;
int i=0;
fp=fopen("FILENAME.txt","wb");
if(fp==NULL)
{
printf("打开文件出错!\n");
exit(0);
}
for(i=0;i<length;i++)
fwrite(inf+i,sizeof(struct information),1,fp);
fclose(fp);
}
/*******************************************************
功能:根据入库编号删除记录
参数:
参数1:information
类型:inf[]
说明:用来存储管理信息的数组
参数2:length
类型:int
说明:表示实际数组的长度
参数3:delete_num1
类型:int
说明:表示要入库编号删除记录
返回值:length
删除后信息的个数
*******************************************************/
int delete_inf(struct information inf[],int delete_num1,int length)
{
int i,j;
char choice;
for(i=0;i<length;i++)
{
if(delete_num1==inf[i].num1)
{
printf("找到啦!它的下标是:%d\n", i);
printf("入库产品编号为: %d\n",inf[i].num2);
printf("入库编号为: %d\n",inf[i].num1);
printf("生产日期: %d年%d月%d日\n",inf[i].sj1[0],inf[i].sj1[1],inf[i].sj1[2]);
printf("入库日期为: %d年%d月%d日\n",inf[i].sj2[0],inf[i].sj2[1],inf[i].sj2[2]);
printf("仓库编号为: %d\n",inf[i].num3);
printf("经办人为: %s\n",inf[i].name);
printf("入库产品单价为: %2.1f\n",inf[i].dj);
printf("入库产品数量为: %d\n",inf[i].sl);
printf("\n\n");
break;
}
}
if(i<length)
{
printf("你确实要删除这个入库编号吗?(Y/N)\n");
getchar();
scanf("%c",&choice);
if(choice=='Y'||choice=='y')
{
for(j=i;j<length;j++)
inf[j]=inf[j+1];
length=length-1;
printf("删除成功!\n");
}
}
else
printf("\n指定的入库编号不存在!\n");
return length;
}
/**********************************************************
功能:打印的纪录
参数1:information
类型:inf[]
说明:用来存储管理信息的数组
参数2:length
类型:int
说明:表示实际数组的长度
返回值:无
**********************************************************/
void print(struct information inf[],int length)
{
int i;
for(i=0;i<length;i++)
{
printf("入库产品编号为: %d\n",inf[i].num2);
printf("入库编号为: %d\n",inf[i].num1);
printf("生产日期: %d年%d月%d日\n",inf[i].sj1[0],inf[i].sj1[1],inf[i].sj1[2]);
printf("入库日期为: %d年%d月%d日\n",inf[i].sj2[0],inf[i].sj2[1],inf[i].sj2[2]);
printf("仓库编号为: %d\n",inf[i].num3);
printf("经办人为: %s\n",inf[i].name);
printf("入库产品单价为: %2.1f\n",inf[i].dj);
printf("入库产品数量为: %d\n",inf[i].sl);
printf("\n\n");
}
}
/*******************************************************
功能:按入库产品编号从小到大显示记录
参数:
参数1:information
类型:inf[]
说明:用来存储管理信息的数组
参数2:length
类型:int
说明:表示实际数组的长度
返回值:无
*******************************************************/
void pailian(struct information inf[],int length)
{
struct information inf1[N];
int i,j,k;
for(i=0;i<length-1;i++)
{
k=i;
for(j=i+1;j<length;j++)
if(inf[k].num2>inf[j].num2)
k=j;
if(k!=i)
{
inf1[N+1]=inf[i];
inf[i]=inf[k];
inf[k]=inf1[N+1];
}
}
}
/*******************************************************
功能:判断入库编号是否唯一
参数:
参数1:information
类型:inf[]
说明:存储管理信息的数组
参数2:length
类型:int
说明:表示实际数组的长度
参数3:peoinf
类型:int
说明:要判断的入库编号
返回值:1或0(flag)
类型:int
说明:1表示入库编号唯一;0表示入库编号不唯一
*******************************************************/
int unique(struct information inf[],int length,int peoinf)
{
int flag=1,i;
for(i=0;i<length;i++)
{
if(inf[i].num1==peoinf)
{
flag=0;
break;
}
}
return (flag);
}
/*******************************************************
功能:统计所有生产入库产品的总金额
参数1:information
类型:inf[]
说明:用来存储管理信息的数组
参数2:length
类型:int
说明:表示实际数组的长度
参数3:t
类型:float
说明:所有生产入库产品的总金额
返回值:t
*******************************************************/
float add(struct information inf[],int length)
{
float t=0;
int i;
for(i=0;i<length;i++)
t+=inf[i].dj*inf[i].sl;
return(t);
}
/*******************************************************
功能:输入信息到结构体数组中
参数:
参数1:information
类型:inf[]
说明:用来存储管理信息的数组
参数2:length
类型:int
说明:表示实际数组的长度
返回值:i
类型:int
说明:表示增加信息后,实际数组的长度
*******************************************************/
int f1(struct information inf[],int Length)
{
int i=Length;
int endFlag=0;
int flag;
printf("请输入产品入库操作管理系统(以入库编号为0结束):\n");
while(i<N)
{
while(1)
{
printf("请输入入库编号: \n");
scanf("%d",&inf[i].num1);
if(inf[i].num1==0)
{
endFlag=1;
break;
}
flag=unique(inf,i,inf[i].num1);
if(flag) break;
printf("该信息已经存在,请重新输入!\n");
}
if(endFlag==1)break;
printf("请选择 入库类型: \n");
printf("++++++++++++++++++++++++++++++++++++++++++++++++++++\n");
printf("* *\n");
printf("* 1: 采购入库 2: 生产入库 3: 入库产品 *\n");
printf("*
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【项目资源】:包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。【项目质量】:所有源码都经过严格测试,可以直接运行。功能在确认正常工作后才上传。【适用人群】:适用于希望学习不同技术领域的小白或进阶学习者。可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。【附加价值】:项目具有较高的学习借鉴价值,也可直接拿来修改复刻。对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。【沟通交流】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。鼓励下载和使用,并欢迎大家互相学习,共同进步。
资源推荐
资源详情
资源评论
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![py](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/EXE.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
共 17 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/6ba19994c6c3461f8cf75ff80f635020_qq_34910341.jpg!1)
CyMylive.
- 粉丝: 7508
- 资源: 4万+
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)