综合性程序设计报告Word下载.docx

上传人:b****5 文档编号:21159856 上传时间:2023-01-28 格式:DOCX 页数:24 大小:558.80KB
下载 相关 举报
综合性程序设计报告Word下载.docx_第1页
第1页 / 共24页
综合性程序设计报告Word下载.docx_第2页
第2页 / 共24页
综合性程序设计报告Word下载.docx_第3页
第3页 / 共24页
综合性程序设计报告Word下载.docx_第4页
第4页 / 共24页
综合性程序设计报告Word下载.docx_第5页
第5页 / 共24页
点击查看更多>>
下载资源
资源描述

综合性程序设计报告Word下载.docx

《综合性程序设计报告Word下载.docx》由会员分享,可在线阅读,更多相关《综合性程序设计报告Word下载.docx(24页珍藏版)》请在冰豆网上搜索。

综合性程序设计报告Word下载.docx

有账目管理

可以查询账目清单

可以计算年度或月份或季度利润

功能模块分解集说明

根据问题描述和要求,系统要求能够实现物资基本信息管理和物资的查询与统计。

确定程序至少应该具备如下功能:

“进货操作”、“售货操作”、“修改信息”、“账目清单”、“月利润查询”等基本模块。

“进货操作”模块的作用是向物资链中增加物资;

“售货操作”模块的作用是记录物资链中售出的商品信息;

“修改信息”模块的作用是修改商品链中的物资信息;

“账目清单”模块的作用是把所有物资的买入与售出信息输出到显示器上;

“利润查询”模块的作用是查询粮油公司的月利润。

经综合考虑系统具有下面5项功能模块:

物资买入,物资卖出,修改信息,账目清单,利润查询……

树状图解析

数据库设计及说明

函数模块

inport();

//为输入操作函数

detail();

//为账目清单函数

change();

//为修改信息函数

outport();

//为收获操作函数

fun1();

//为菜单函数

profit();

//为月利润查询函数

结构体

structitem

{

intnum1;

charname[9];

floatprize;

floatnum2;

structitem*next;

};

说明:

此为物资基本信息包括:

编号,商品名称,进价,数量。

运用动态链表,可以多次输入。

指针

structitem*head;

structitem*p1,*p2;

//定义此指针*p1,*p2指向struct结构体,运用链表不断延伸。

宏定义

#definelengthsizeof(structitem)

#definelength1sizeof(structitem1)

#definelength2sizeof(structitem2)

文件操作

本程序建”xls,xls1”两个,每次操作后,文件中信息得到相应修改并重新储存

界面说明

进入菜单,会有六个选项,功能如上图。

输入对应的代码,可执行该功能。

设定共可以管理的物资有四种,分别为小麦、大米、大豆利润查询功能中只处理以上三种名称。

在进货时输入进货编号、进价等,售货时输入售价与售货日期,程序自动计算出利润。

示例:

1.进入程序出现主菜单如图

2.选“1”进行进货操作,界面如图:

3.选“2”,进行售货操作,界面如图:

4.选“3”,进行修改信息,界面如图:

5.选“4”,查看账目信息,结果如图:

6.选“5”,查询月利润,如图

代码及注释

#include<

stdio.h>

#include<

stdlib.h>

string.h>

malloc.h>

voidinport()

{

staticinta;

charc1[8];

FILE*p;

floatprice;

structitem*next;

structitem*head,*p1,*p2;

p1=p2=(structitem*)malloc(length);

/*开辟一个新单元*/

if((p=fopen("

xls"

"

a+"

))==0)

{

printf("

文件打开错误"

);

}

a=0;

head=NULL;

for(;

;

printf("

请输入商品的编号\n"

scanf("

%d"

&

p1->

num1);

getchar();

printf("

请输入商品的名称\n"

scanf("

%s"

p1->

name);

请输入商品的进价\n"

%f"

price);

请输入商品的数量(kg)\n"

num2);

if(fwrite(p1,length,1,p)!

=1)

无法保存!

\n"

else

保存成功!

\t\t是否继续输入?

(y/n)\n"

c1);

if(strcmp(c1,"

n"

)==0||strcmp(c1,"

N"

)==0)

break;

if((a+1)==1)head=p1;

p2->

next=p1;

p2=p1;

p1=(structitem*)malloc(length);

}

p2->

next=NULL;

}

voidoutport()

charc1[2]="

FILE*fp;

charnum1[3];

floatnum3;

if((fp=fopen("

xls1"

))==NULL)printf("

文件打开错误!

for(a=1;

a;

a++)

请输入销售商品的年月日(如2011/1/12)\n"

请输入商品的编号"

num3);

请输入商品的售价\n"

请输入商品的数量\n"

if(fwrite(p1,length,1,fp)!

elseprintf("

"

c1);

if((strcmp(c1,"

)==0)||(strcmp(c1,"

)==0))break;

if(a==1)head=p1;

elsep2->

voidchange()

FILE*p,*fp;

inta,b,e,f,d;

chars[2];

structitem1

structitem1*next;

structitem2

intnum1[3];

intnum3;

structitem2*next;

structitem1*head1=NULL,*p1,*p2;

structitem2*head2=NULL,*p3,*p4;

p1=p2=(structitem1*)malloc(length1);

p3=p4=(structitem2*)malloc(length2);

for(;

修改选项如下:

\n1.进货情况;

\n2.销售情况\n"

a);

switch(a)

case1:

rb"

))==NULL)

打不开文件\n"

system("

pause"

p1=p2=(structitem1*)malloc(length1);

for(e=0;

(!

feof(p))==0;

e++)

if(fread(p1,length1,1,p)==0)

{

printf("

无此项纪录!

system("

}

if(e==0)

head1=p1;

else

p2->

p2=p1;

p1=(structitem1*)malloc(length1);

p2->

请输入欲修改物品的编号:

f);

while(p2->

next)

if((f==p1->

num1))

{

请输入要修改的项目:

\n1.商品名称\n2.进价\n数量\n"

scanf("

d);

switch(d)

case1:

printf("

请输入商品名称:

scanf("

};

break;

case2:

请输入商品进价:

case3:

{printf("

请输入商品数量:

default:

输入错误!

system("

}

fun1();

break;

}

break;

fclose(p);

if((fp=fopen("

p4=p3=(structitem2*)malloc(length2);

!

feof(fp);

if(fread(p3,length2,1,fp)!

head2=p3;

p4->

next=p3;

p4=p3;

p3=(structitem2*)malloc(length2);

p4->

请输入欲修改商品编号:

while(p4->

if(f==(p3->

num3))

\n1.商品名称\n2.售价\n数量\n"

p3->

请输入商品售价:

p3->

break;

};

fclose(fp);

default:

printf("

输入错误!

是否继续y/n?

s);

if(strcmp(s,"

y"

)||strcmp(s,"

Y"

}}

voiddetail()

inta,b,c,e,f,d;

structitem1*head1=NULL,*p1,*p2;

if(((p=fopen("

))==0))

{

else

进货情况如下:

while(feof(p)!

=0)

if(fread(p1,length1,1,p)!

=0){printf("

\t商品编号\t商品名称\t进价\t数量\t\n"

\t%d\t%s\t%f\t%f\n"

num1,p3->

name,p3->

price,p3->

else{

}

if(((fp=fopen("

else{

销售情况如下:

while(!

feof(fp)==0)

销售日期\t商品名称\t售价\t数量\t商品编号"

%s\t%s\t%f\t%f\n"

if(f==0)

system("

voidprofit()

{

FILE*p;

FILE*fp;

inta,b,c,e,f,d,i1,j1,g1,i2,j2,g2;

structitem2*head2=NULL,*p3,*p4;

head1=NULL;

head2=NULL;

))==NULL)

feof(p)==0);

if((fread(p1,length1,1,p))!

if(p1->

num1==1)

i1+=(p1->

num2)*(p1->

else

if(p1->

num1==2)

j1+=(p1->

else

g1+=(p1->

else

for(f=0;

((!

feof(fp))==0);

f++)

if((fread(p3,length2,1,fp))!

if((p3->

num3)==1)

i2+=(p3->

num2)*(p3->

else

if(p3->

num3==2)

i2+=(p3->

else

g2+=(p3->

商品\t\t利润\n"

玉米\t\t%f/n大豆\t\t%f\n小麦\t\t%f\n"

i2-i1,j2-j1,g2-g1);

voidfun1()

system("

cls"

\n\n\n\n\n\n"

\t*****************************菜单************************\n"

\t\t欢迎进入粮油公司进销存管理系统!

\n\n"

\t\t0.退出\n"

\t\t1.进货操作\n"

\t\t2.售货操作\n"

\t\t3.修改信息\n"

\t\t4.账目清单\n"

\t\t5.利润查询\n"

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 总结汇报 > 学习总结

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1