C语言做个小型商品销售管理系统

5.9题目九:小型商品信息管理系统
设计一个商品信息管理系统,模拟超市商品管理。
对商品信息进行分类:日用品,食品,电器
各类商品包括的信息有: 编号,商品名称,商品类别,产地,供货商,单价,库存数量,采购日期。
系统实现下述功能:
(1)能录入商品信息
(2)能对商品信息进行查询
可以按编号,按商品名称,按商品类别,按供货商,按产地进行查询
(3)可以对商品信息进行修改,删除
(4)可以对新商品进行入库登记
要求:界面友好,易于操作,采用二进制文件存储数据。

5.10题目十:小型商品销售管理系统
此题可与9题合做。
设计一个商品销售系统,模拟超市商品销售流程。
销售单包含的信息如下:流水号,商品编号,销售数量,销售单价,销售日期,销售人员
系统实现下述功能:
(1) 商品销售:
要求:输入销售单,根据商品编号,读取并显示磁盘文件中的商品信息,根据销售数量,修改库存,
(2) 商品销售信息查询:
a) 根据商品编号查询
b) 根据销售日期查询
c) 根据销售人员查询
(3)统计
a) 日销售额 b) 月销售额 c) 季销售额 d) 月度销售排名 e)。。。
(4)库存信息提醒

我这里有一个!
具体的,稍微改一下就可以了!

#include "stdio.h" /*I/O函数*/
#include "stdlib.h" /*其它说明*/
#include "string.h" /*字符串函数*/
#include "conio.h" /*屏幕操作函数*/
#include "mem.h" /*内存操作函数*/
#include "ctype.h" /*字符操作函数*/
#include "alloc.h" /*动态地址分配函数*/
struct score
{
int mingci;
char xuehao[8];
char mingzi[20];
float score[6];
}data,info[1000];
int i,j,k=0;
char temp[20],ch;
FILE *fp,*fp1;

void shuru()
{
if((fp=fopen("s_score.txt","ab+"))==NULL)
{
printf("cannot open this file.\n");
getch();exit(0);
}
for(i=0;i<=1000;i++)
{
printf("\nPlease shuru xuehao:");
gets(data.xuehao);
printf("Please shuru mingzi:");
gets(data.mingzi);
printf("Please shuru yuwen score:");
gets(temp);data.score[0]=atof(temp);
printf("Please shuru shuxue score:");
gets(temp);data.score[1]=atof(temp);
printf("Please input yingyu score:");
gets(temp);data.score[2]=atof(temp);
printf("Please shuru wuli score:");
gets(temp);data.score[3]=atof(temp);
printf("Please shur huaxue score:");
gets(temp);data.score[4]=atof(temp);
data.score[5]=data.score[0]+data.score[1]+data.score[2]+data.score[3]+data.score[4];
fwrite(&data,sizeof(data),1,fp);
printf("another?y/n");
ch=getch();
if(ch=='n'||ch=='N')
break;
} fclose(fp);
}
void xianshi()
{
float s;int n;
if((fp=fopen("s_score.txt","rb+"))==NULL)
{
printf("Cannot reading this file.\n");
exit(0);
}
for(i=0;i<=1000;i++)
{
if((fread(&info[i],sizeof(info[i]),1,fp))!=1)
break;
}
printf("\nxuehao mingzi yuwen shuxue yingyu wuli huauxue zhongfen\n");
for(j=0,k=1;j<i;j++,k++)
{
info[j].mingci=k;
printf("%6s %8s %3.1f %3.1f %3.1f %3.1f %3.1f %3.1f\n",info[j].xuehao,info[j].mingzi,info[j].score[0],info[j].score[1],info[j].score[2],info[j].score[3],info[j].score[4],
info[j].score[5]);
}
getch();
fclose(fp);
}

void xiugai()
{
if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL)
{
printf("Cannot open this file.\n");
exit(0);
}
printf("\nPLease shuru xiugai xuehao:");
scanf("%d",&i); getchar();
while((fread(&data,sizeof(data),1,fp))==1)
{
j=atoi(data.xuehao);
if(j==i)
{
printf("xuehao:%s\nmingzi:%s\n",data.xuehao,data.mingzi);
printf("Please shuru mingzi:");
gets(data.mingzi);
printf("Please shuru yuwen score:");
gets(temp);data.score[0]=atof(temp);
printf("Please shuru shuxue score:");
gets(temp);data.score[1]=atof(temp);
printf("Please input yingyu score:");
gets(temp);data.score[2]=atof(temp);
printf("Please input wuli score:");
gets(temp);data.score[3]=atof(temp);
printf("Please input huaxue score:");
gets(temp);data.score[4]=atof(temp);
data.score[5]=data.score[0]+data.score[1]+data.score[2]+data.score[3]+data.score[4];

} fwrite(&data,sizeof(data),1,fp1);
}
fseek(fp,0L,0);
fseek(fp1,0L,0);
while((fread(&data,sizeof(data),1,fp1))==1)
{
fwrite(&data,sizeof(data),1,fp);
}

fclose(fp);
fclose(fp1);
}
void chazhao()
{
if((fp=fopen("s_score.txt","rb"))==NULL)
{
printf("\nCannot open this file.\n");
exit(0);
}
printf("\nPLease shuru xuehao chakan:");
scanf("%d",&i);
while(fread(&data,sizeof(data),1,fp)==1)
{
j=atoi(data.xuehao);
if(i==j)
{
printf("xuehao:%s mingzi:%s\nyuwen:%f\n shuxue:%f\n yingyu:%f\n wuli:%f\n huaxue:%f\n ",data.xuehao,data.mingzi,data.score[0],data.score[1],data.score[2],data.score[3],data.score[4],data.score[5]);
}getch();
}
}
void shanchu()
{
if((fp=fopen("s_score.txt","rb+"))==NULL||(fp1=fopen("temp.txt","wb+"))==NULL)
{
printf("\nopen score.txt was failed!");
getch();
exit(0);
}
printf("\nPlease input ID which you want to del:");
scanf("%d",&i);getchar();
while((fread(&data,sizeof(data),1,fp))==1)
{
j=atoi(data.xuehao);
if(j==i)
{

printf("Anykey will delet it.\n");
getch();
continue;
}
fwrite(&data,sizeof(data),1,fp1);
}
fclose(fp);
fclose(fp1);
remove("s_score.txt");
rename("temp.txt","s_score.txt");
printf("Data delet was succesful!\n");
printf("Anykey will return to main.");
getch();
}
main()
{
while(1)
{
clrscr(); /*清屏幕*/
gotoxy(1,1); /*移动光标*/
textcolor(YELLOW); /*设置文本显示颜色为黄色*/
textbackground(BLUE); /*设置背景颜色为蓝色*/
window(1,1,99,99); /* 制作显示菜单的窗口,大小根据菜单条数设计*/
clrscr();
printf("*************welcome to use student manage******************\n");
printf("*************************menu********************************\n");
printf("* ========================================================= * \n");
printf("* 1>shuru 2>xiugai * \n");
printf("* 3>shanchu 4>chazhao * \n");
printf("* 5>xianshi 6>exit * \n");
printf("* * \n");
printf("* --------------------------------------------------------- * \n");
printf(" Please input which you want(1-6):");
ch=getch();
switch(ch)
{
case '1':shuru();break;
case '2':xiugai(); break;
case '3':shanchu(); break;
case '4':chazhao(); break;
case '5':xianshi(); break;
case '6':exit(0);
default: continue;
}
}
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-06-19
有木有
商品销售管理
问题描述:
已知一公司有10种产品(产品编号,产品名称,产品价格,产品产地,库存数量(最开始为1000个)),设计一程序,完成以下功能:
销售:从键盘输入顾客姓名,销售数量、销售日期,实现销售功能。需要判断产品是否存在,销售数量是否小于库存数量,销售日期格式是否合法(格式为:YYYY-MM-DD,如2009-01-02))销售时间必须通过调用系统时间获得。
能根据产品编号查询产品的销售历史
计算时间段内各个产品的销售总额
能根据顾客姓名,查询购买历史
能显示所有顾客的姓名
所有数据符合实际应用要求
提示:
定义一个日期结构体保存日期,具体信息为:年、月、日
判断存款日期和取款日期的格式是否合法时,需要判断长度是否为10,第5位和第8位是否为’-’,字符,将1-4位表示的年份,6-7位表示的月份,9-10位表示的日期分别转换成整数。判断是否满足构成日期的条件闰年月份只能是1-12之间的数,如果是闰年,二月可以是29天否则不能大于28,1,3,5,7,8,10,12月可以是31天,其余只能小于等于30(建议写成函数)。
定义一个结构体数组保存10种产品信息,具体信息为:产品编号,产品名称,产品价格,产品产地,库存数量(最开始为1000个)
定义一个链表,保存销售信息,具体为:顾客代码,销售数量、销售日期。
定义一个链表保存顾客信息,具体为:顾客代码,顾客姓名
当输入销售信息时查询顾客链表,如果在链表中存在该姓名的顾客记录,则将其代码在该销售链表中插入一条记录,如果不存在,则在顾客链表中插入一条记录,(顾客代码需要自动生成)。
第2个回答  2008-06-25
我有,你向我发消息
第3个回答  2008-06-26
怎样改 啊具体一点啊
相似回答