c语言销售管理系统(共20页).docx

上传人:飞****2 文档编号:16308184 上传时间:2022-05-16 格式:DOCX 页数:20 大小:42.93KB
返回 下载 相关 举报
c语言销售管理系统(共20页).docx_第1页
第1页 / 共20页
c语言销售管理系统(共20页).docx_第2页
第2页 / 共20页
点击查看更多>>
资源描述

《c语言销售管理系统(共20页).docx》由会员分享,可在线阅读,更多相关《c语言销售管理系统(共20页).docx(20页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、精选优质文档-倾情为你奉上C语言销售管理系统课设满分作品带报表和折线图显示#include #include #include #include#include#include#include#define NULL 0CONSOLE_SCREEN_BUFFER_INFO csbiInfo;extern WINBASEAPI HWND WINAPI GetConsoleWindow();void input();/实现手动输入销售信息void menu();/程序菜单主界面显示void daoru(); /函数声明void seek();/销售信息查询void save();/销售信息保存vo

2、id del();/销售信息删除void def();/销售信息初始化void history(people);/实现销售历史查询void clear();/实现清屏void filepath();/判断是否为默认文件位置,及询问是否要求修改文件位置void baobiao();/打印报表void txt(zx);/折线图void sxt(g1, g2, g3, g4, g5);/扇形图int ghj = 1;int file_choose = 0;/文件导入初始状态 /全局变量char filename30 = sell.txt;/默认文件位置int price5 = 2, 2, 2, 2,

3、 2 ; /默认商品价格struct goodint num;/产品编号int f_name10;/产品名称float price;/产品价格商品属性int date;/销售日期int sum;/销售数量 good5;/定义商品属性结构体,及五个商品struct sellerint num;/销售员编号char name8;/销售员姓名char sex;/销售员性别structgood good5;/五种商品 sell4; /定义销售员结构体,及四个销售员struct daystruct seller sell4; d31;struct yearstruct day d31; m12;int

4、main(int argc, char* argv)int x = 0;x = MessageBox(NULL, 欢迎使用销售管理系统n作者:xxn班级:xxxx, 欢迎, MB_YESNO);if (x = 6) menu();return 0;/*函 数 名:daoru()*描 述:从文件导入数据*入口参数:无;*出口参数:无;*/void daoru()FILE *fp;int i, day, month;if (fp = fopen(filename, r) = NULL)printf(文件不存在!);return;for (month = 0; month12; month+)for

5、 (day = 0; day31; day+)/把文件读取到内存中for (i = 0; i4; i+)fscanf(fp, %6d%6d%6d%6d%6dn, &mmonth.dday.selli.good0.sum, &mmonth.dday.selli.good1.sum, &mmonth.dday.selli.good2.sum, &mmonth.dday.selli.good3.sum, &mmonth.dday.selli.good4.sum);fclose(fp);/*函 数 名:inpit()*描 述:数据的手动输入*入口参数:无;*出口参数:无;*/void input()i

6、nt i = 0, day = 0, x = 0, month = 0;filepath();daoru();/文件导入及判断printf(请输入要查找的日期如1 1即一月一日:);scanf(%d%d, &month, &day);month-;day-;/保持实际时间与数组一致printf(请输入销售人员编号:n1:xx 2:xx 3:xx 4:xx:);scanf(%d, &i);i-;printf(请输入具体要录入的商品种类15对应商品1-5:);/用于查找所需的具体数据scanf(%d, &x);x-;printf(输入销售数量:);scanf(%d, &mmonth.dday.se

7、lli.goodx.sum);printf(完成!);save();/*函 数 名:seek()*描 述:查找*入口参数:无;*出口参数:无;*/void seek()char ch;int i = 0, j = 0, choose = 0, day = 0, t = 0, all = 0, month;filepath();daoru();printf(请输入要查找的日期如1 1即一月一日:);scanf(%d%d, &month, &day);month-;day-;/保持实际时间与数组一致printf(请输入销售人员编号:n1:xx 2:xx 3:xx 4:xx:);scanf(%d,

8、&i);i-;printf(请选择1,当天具体商品销售情况 2,当天该销售员销售情况:);scanf(%d, &choose);switch (choose)case 1: printf(请输入具体要查找的商品种类15对应商品1-5n); scanf(%d, &t); t-; printf(该销售员这天销售本商品的数量为:%d, mmonth.dday.selli.goodt.sum);break;case 2: printf(产品代号n); printf(1.牛奶 2.西瓜 3.苹果 4.白菜 5.萝卜 销售之和n); for (j = 0; j5; j+)all += mmonth.dda

9、y.selli.goodj.sum; printf(%-8d%-8d%-8d%-8d%-8d%-10dn, mmonth.dday.selli.good0.sum, mmonth.dday.selli.good1.sum, mmonth.dday.selli.good2.sum, mmonth.dday.selli.good3.sum, mmonth.dday.selli.good4.sum, all);default:break;/*函 数 名:baobiao()*描 述:打印报表*入口参数:无;*出口参数:无;*/void baobiao()char choose = y;int i, j

10、, x = 0, a = 0, b = 0, mo = 0, th = 0, partsum = 0, month = 0, sj = 0;int day = 0, alldat = 0, partallsum5 = 0 ;int mx45 = 0 , mxsum = 0; /用于存放明细filepath();daoru();/读取数据及判断printf(请选择1销售数量报表 2销售额报表:);scanf(%d, &i);if (i = 1)for (i = 0; i0)for (month = mo + 1; month = (th - 1); month+)for (day = 0; da

11、y31; day+)for (i = 0; i4; i+)for (j = 0; j = 4; j+)mxij = mxij + mmonth.dday.selli.goodj.sum*pricej;/累加计算所有他的所有销售情况for (i = 0; i5; i+)for (j = 0, partsum = 0; j4; j+)partsum += mmonth.dday.sellj.goodi.sum*pricei;/统计同种商品数目,一维数组当天4个销售员 同种商品数目partallsumi += partsum;/间隔整月前一段for (day = a; day31; day+)for

12、 (i = 0; i4; i+)for (j = 0; j = 4; j+)mxij = mxij + mmo.dday.selli.goodj.sum*pricej;/累加计算所有他的所有销售情况for (i = 0; i5; i+)for (j = 0, partsum = 0; j4; j+)partsum += mmo.dday.sellj.goodi.sum*pricei;partallsumi += partsum;/统计同种商品数目,一维数组当天4个销售员 同种商品数目/间隔整月后一段for (day = 0; day = b; day+)for (i = 0; i4; i+)f

13、or (j = 0; j = 4; j+)mxij = mxij + mth.dday.selli.goodj.sum*pricej;/累加计算所有他的所有销售情况for (i = 0; i5; i+)for (j = 0, partsum = 0; j4; j+)partsum += mth.dday.sellj.goodi.sum*pricei;partallsumi += partsum;/统计同种商品数目,一维数组当天4个销售员 同种商品数目else if (th - mo) = 0)for (day = a; day = b; day+)for (i = 0; i4; i+)for

14、(j = 0; j = 4; j+)mxij = mxij + mmo.dday.selli.goodj.sum*pricej;/累加计算所有他的所有销售情况for (i = 0; i5; i+)for (j = 0, partsum = 0; j4; j+)partsum += mmo.dday.sellj.goodi.sum*pricei;partallsumi += partsum;/统计同种商品数目,一维数组当天4个销售员 同种商品数目/输出报表for (i = 0; i4; i+)printf(%-6s , selli.name);/销售员姓名for (j = 0; j5; j+)p

15、rintf(t%d, mxij);mxsum += mxij;/二维数组记录销售员printf(t%dn, mxsum);mxsum = 0;/用于下次循环 的初始化/输出表格同类商品总计printf(同类商品);for (i = 0; i5; i+)printf(t%d, partallsumi);/统计同种商品数目,一维数组alldat += partallsumi;/合计所有的商品printf(t合计:%d, alldat);/所有商品合计x = MessageBox(NULL, 是否打印扇形形图?, 提示, MB_YESNO);if (x = 6)clear();printf(时间段:

16、%d月%d日-%d月%d日, mo + 1, a + 1, th + 1, 1 + b);printf( 销售扇形图);sxt(partallsum0, partallsum1, partallsum2, partallsum3, partallsum4);/*函 数 名:del()*描 述:删除*入口参数:无;*出口参数:无;*/void del()int i = 0, day = 0, x = 0, month;int choose;filepath();daoru();printf(请输入要查找日期如1月1日 输入1 1:);scanf(%d%d, &month, &day);month

17、-;day-;/保持实际时间与数组一致printf(请输入销售人员编号:n1:xx 2:xx 3:xx 4:xx:);scanf(%d, &i);i-;printf(请选择1.删除该销售员整天的销售信息 2.具体商品销售信息:);scanf(%d, &choose);switch (choose)case 1: for (x = 0; x5; x+)mmonth.dday.selli.goodx.sum = 0;break;case 2: printf(请输入具体要删除的商品种类15对应商品1-5 :); scanf(%d, &x); x-; mmonth.dday.selli.goodx.s

18、um = 0;break;default:break;printf(已删除指定销售员信息);save();/*函 数 名:def()*描 述:销售数据初始化*入口参数:无;*出口参数:无;*/void def()FILE *fp;int i, day, month;filepath();fp = fopen(filename, w);for (month = 0; month12; month+)for (day = 0; day31; day+)for (i = 0; i4; i+) /保存信息到文件fprintf(fp, %-6d%-6d%-6d%-6d%-6dn, mmonth.dday

19、.selli.good0.sum = 0, mmonth.dday.selli.good1.sum = 0, mmonth.dday.selli.good2.sum = 0, mmonth.dday.selli.good3.sum = 0, mmonth.dday.selli.good4.sum = 0);fprintf(fp, n);/日期间隔printf(初始化操作完成!);fclose(fp);/*函 数 名:filepath()*描 述:判断及修改文件位置*入口参数:无;*出口参数:无;*/void filepath()char choose;int x;clear();if (fil

20、e_choose = 0)x = MessageBox(NULL, 现在为默认文件n是否使用?, 提示, MB_YESNO);if (x = 7)printf(请输入文件绝对路径:);fflush(stdin);gets(filename);file_choose = 1;/其他位置文件 标志elsex = MessageBox(NULL, 不在提醒?, 提示, MB_YESNO);if (x = 6)file_choose = 2;/其他位置文件 标志printf(设置成功n);/*函 数 名:save()*描 述:保存数据*入口参数:无;*出口参数:无;*/void save(people

21、)FILE *fp;intday, i, month;fp = fopen(filename, w);for (month = 0; month12; month+)for (day = 0; day31; day+)for (i = 0; i4; i+)fprintf(fp, %-6d%-6d%-6d%-6d%-6dn, mmonth.dday.selli.good0.sum, mmonth.dday.selli.good1.sum, mmonth.dday.selli.good2.sum, mmonth.dday.selli.good3.sum, mmonth.dday.selli.goo

22、d4.sum);fprintf(fp, n);/写入文件fclose(fp);/*函 数 名:clear()*描 述:清屏*入口参数:无;*出口参数:无;*/void clear()int i;HWND hwnd;HANDLE hOut;HDC hdc, hdc1;HPEN ypn, p_pn, p1_pn, p2_pn, p3_pn, p4_pn, p5_pn;HPEN hPen, hOldPen;HBRUSH hBrush, hOldBrush, hbr;COORD pos = 1, 4 ;hwnd = GetConsoleWindow();hdc = GetDC(hwnd);hOut =

23、 GetStdHandle(STD_OUTPUT_HANDLE);hbr = CreateSolidBrush(RGB(0, 0, 0);SelectObject(hdc, hbr);Rectangle(hdc, 0, 65, 670, 470);SetConsoleCursorPosition(hOut, pos);for (i = 0; i0)/间隔整月前一段for (day = a; day= 16)x = MessageBox(NULL, 是否显示更多?, 提示, MB_YESNO);if (x = 6)clear();printf(日期 t1.牛奶t2.西瓜t3.苹果t4.白菜t5.

24、萝卜t销售之和n);more = 0;else goto end;printf(%d月%d日 , mo + 1, day + 1);for (j = 0; j = 4; j+)sumall += mmo.dday.sellpeople.goodj.sum;printf(t%d, mmo.dday.sellpeople.goodj.sum);mxj += mmo.dday.sellpeople.goodj.sum;printf(t%dn, sumall);more+;mx5 += sumall;sumall = 0;/计算间隔整月for (month = mo + 1; month = (th

25、- 1); month+)for (day = 0; day= 16)x = MessageBox(NULL, 是否显示更多?, 提示, MB_YESNO);if (x = 6)clear();printf(日期 t1.牛奶t2.西瓜t3.苹果t4.白菜t5.萝卜t销售之和n);more = 0;else goto end;printf(n%d月%d日 , month + 1, day + 1);for (j = 0; j = 4; j+)sumall += mmonth.dday.sellpeople.goodj.sum;printf(t%d, mmonth.dday.sellpeople.

26、goodj.sum);mxj += mmonth.dday.sellpeople.goodj.sum;printf(t%d, sumall);more+;mx5 += sumall;sumall = 0;/间隔整月后一段for (day = 0; day = 16)x = MessageBox(NULL, 是否显示更多?, 提示, MB_YESNO);if (x = 6)clear();printf(日期 t1.牛奶t2.西瓜t3.苹果t4.白菜t5.萝卜t销售之和n);more = 0;else goto end;printf(n%d月%d日 , th + 1, day + 1);for (

27、j = 0; j = 4; j+)sumall += mth.dday.sellpeople.goodj.sum;printf(t%d, mth.dday.sellpeople.goodj.sum);mxj += mth.dday.sellpeople.goodj.sum;printf(t%d, sumall);more+;mx5 += sumall;sumall = 0;/一个月内时间段else if (th - mo) = 0)for (day = a; day = 18)x = MessageBox(NULL, 是否显示更多?, 提示, MB_YESNO);if (x = 6)clear

28、();printf(日期 t1.牛奶t2.西瓜t3.苹果t4.白菜t5.萝卜t销售之和n);more = 0;else goto end;printf(%d月%d日 , mo + 1, day + 1);for (j = 0; j = 4; j+)sumall += mmo.dday.sellpeople.goodj.sum;printf(t%d, mmo.dday.sellpeople.goodj.sum);mxj += mmo.dday.sellpeople.goodj.sum;printf(t%dn, sumall);more+;mx5 += sumall;sumall = 0;end:printf(n合计: );for (j = 0; j = 4; j+)printf(t%d, mxj);printf(t总计:%dn完成!, mx5);x = MessageBox(NULL, 是否打印条形图?, 提示, MB_YESNO);if (x = 6)clear();printf(销售员:%s 时间段:%d月%d日-%d月%d日n, sellpeople.name, mo + 1, a + 1, th + 1, 1 + b);printf(nnnn 历史销售统计条形图);for (j = 0; j = 4; j+)txt(mxj);

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 教案示例

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁