数据库实验项目任务分配及进度安排
广 州 大 学
实 验 报 告
学 院 商学院 专业、班级 11级电子商务 姓名、学号 许文权 1113800014 课程名称 c程序设计 项目名称 综合性实验
实验时间: 2012 年 5 月 29 日
实验5综合性实验
一、 实验目的
1. 掌握各种程序设计技术的综合应用方法,
2. 掌握对实际应用中的一个具体问题进行分析的方法, 3. 掌握将现实世界中的事物或现象转换成计算机内部的数据的方法, 4. 初步掌握结构化分析方法,
5. 初步掌握设计一个具有真实数据输入、数据处理和数据输出的完整的小
程序的方法。
二、 实验内容
某企业有一个仓库~现有大量货物。为对仓库中存储的货物进行有效的管理~现需要设一个程序~来实现对现有货物进行汇总统计。请设计一个程序~实现上述操作。
三、 实验指导
1. 提示信息
对于仓库中存储的货物~应保存的信息可概括为如下属性:
, 货物号
, 货物名
, 生产厂家
, 同类产品的数量
, 价格
, 生产日期
, 进货日期
, 经手人
对于对货物要进行的处理分为:
, 清点入库,设计一个用户界面~输入货物信息~结果存入一个你自
己设计的文件中,
, 统计分析,统计货物的总价值、某一厂商生产物品的数量、价格等, 2. 设计要求
本实验要求学完成一个能进行仓库数据存储及显示的程序:
, 根据给定的仓库管理数据~设计数据存储所使用的技术,
, 设计各模块要采用的技术,
, 设计、调试,
, 撰写说明书;
, 提交一个完整的实用小程序。
三(
#include "stdafx.h" #include
#include
#include
#include struct goods
{
int num;
char name[20];
char producer[20];
float price;//价格
int date_of_production;
int purchase_date;
char handling[20];
}goods[3];
void information()//定义货物信息函数
{
int i;
for(i=0;i<3;i++)
{
printf("Please input the goods information.\n");
printf("货物号 货物名 生产厂家 价格 生产日
期 进货日期 经手人\n");
scanf("%d %s %s %d %d %d %s",&goods[i].num,goods[i].name,&goods[i].producer,&goods[i].price,&goods[i].date_of_production,
&goods[i].purchase_date,&goods[i].handling);
}
printf("press any key...\n");
getch();
}
void count_name()//定义货物名函数
{
int i,count=0;
char m[10];
printf("货物名/类型有:");
for(i=0;i<3;i++)
printf("%s\n ",goods[i].name);
printf("\n");
printf("请输入要查找的货物名/类型:\n");
scanf("%s",&m);
for(i=1;i<3;i++)
{
if(strcmp(m,goods[i].name)==0) count++;
}
printf("货物名/类型为%s的数量为%d\n",m,count); printf("press any key...\n"); getch();
}
void count_num()//定义货物号函数
{
int i,count=0;
int num;
printf("请输入要查找的货物号:\n");
scanf("%d",&num);
for(i=0;i<3;i++)
{
if(num==goods[i].num) count++;
}
printf("货物号为%d的数量为%d\n",num,count);
printf("press any key...\n");
getch();
}
void count_price()//定义货物价格函数
{
int i,count=0;
float price=0.0;
printf("请输入要查找的价格:\n");
scanf("%f",&price);
if(price==0)
{
printf("error!\n");
}
for(i=0;i<3;i++)
{ if(price==goods[i].price) count++;
}printf("价格为%f的货物数量为:%d\n",price,count);
printf("press any key...\n"); getch();
}
void count_producer()//定义生产厂家函数
{
int i,count=0;
char m[10];
printf("请输入要查找的生产厂家:\n");
scanf("%s",m);
for(i=0;i<3;i++)
{
if(strcmp(m,goods[i].producer)==0) count++;
}
printf("生产厂家%s的货物数量为%d\n",m,count);
printf("press any key...\n");
getch();
}
void count_date_of_production()//定义生产日期函数
{
int i,count=0;
int date_of_production;
printf("请输入要统计的生产日期:\n");
scanf("%d",&date_of_production);
for(i=0;i<3;i++)
{
if(date_of_production==goods[i].date_of_production)
count++;
}
printf("同一天生产的产品数量为%d\n",count);
printf("press any key...\n");
getch();
}
void count_purchase_date()//定义进厂日期函数
{
int i,count=0;
int purchase_date;
printf("请输入要统计的进厂日期:\n");
scanf("%d",&purchase_date);
for(i=0;i<3;i++)
{
if(purchase_date==goods[i].purchase_date) count++;
}
printf("同一天进厂的产品数量为%d\n",count);
printf("press any key...\n");
getch();
}
void s()//定义统计货物总价值函数
{
int i;
float sum=0.0;
for(i=0;i<3;i++)
sum=sum+goods[i].price;
printf("库存货物的总值为:%f\n",sum);
printf("press any key...\n");
getch();
}
int main(int argc, char* argv[]) {
char ch;
while(1)
{
system("cls");
printf("请选择你要运行的操作:\n");
printf("1.输入货物信息\n");
printf("2.统计货物名/类型相同的货物的数量\n");
printf("3.统计货物号相同的货物的数量\n");
printf("4.统计相同价格的货物的数量\n");
printf("5.统计生产厂家相同的货物的数量\n");
printf("6.统计生产日期相同的货物的数量\n");
printf("7.统计进货日期相同的货物的数量\n");
printf("8.统计库存货物的总值\n");
printf("9.退出\n");
ch=getch();
if(ch=='9')
break;
system("cls");
switch(ch){
case '1':information();break;
case '2':count_name();break;
case '3':count_num();break;
case '4':count_price();break;
case '5':count_producer();break;
case '6':count_date_of_production();break;
case '7':count_purchase_date();break;
case '8':s();break;
}
}
return 0;
}
四(实验结果
这程序有错误~但是自己水平有限~发现不了~输入完一个数据~
就跳出去~感觉很难搞。这程序也太长长长啦~看到我眼花了。
本文档为【数据库实验项目任务分配及进度安排】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。