#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include "direct.h"
#include <string.h>
#include <io.h>
#include<time.h>
#include"conio.h"
#include<dos.h>
#include<windows.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include "direct.h"
#include <string.h>
#include <io.h>
#include<time.h>
#include"conio.h"
#include<dos.h>
#include<windows.h>
void look(); /*声明打印所有小票函数*/
void search_fruit(); /*声明按水果种类打印销售量函数*/
void del(); /*声明删除函数*/
void sum(); /*声明统计销售额函数*/
void type(); /*声明输入函数*/
void bigfind(); /*声明大额购物信息查看函数*/
void timefind();
void vipfind();
void change();
void menu();
void loading();
struct gouwu {
int num;
struct fruit {
char a[21], b[21], c[21], d[21], e[21];
}f;
struct geshu {
int a, b, c, d, e;
}g;
float heji;
char zhifu[10];
char time[64];
}cos[31], cos1[31], cos2[31], cos3[31], cos4[31], cos5[31];
char timm[64];
int main() /*主函数即用户的操作界面*/
{
loading();
menu();
}
void type() {
system("CLS");
FILE *fp, *fq;
time_t times;
tm *tim;
char *wday[] = { "日","一","二","三","四","五","六" };
struct tm *tblock;
int F, t, i, m, jieshu = 1, A, xuhao;
float price1 = 5.00, price2 = 4.00, price3 = 3.00, price4 = 2.00, price5 = 1.00, H, p2, p1, p3, p4, p5, M1, M2, money2, v1, v2;
char ch[10], c[4] = { '1','0','0','0' };
fp = fopen("xuhao.txt", "rb");
if (fp == NULL)
{
printf("打开序号文件失败\n");
printf("按任意键返回主菜单\n");
getch();
menu();
}
fread(&xuhao, sizeof(int), 1, fp);
xuhao = xuhao * 1 + 1;
fclose(fp);
for (i = xuhao - 1; i <= 30; i++)
{
printf("********************************************\n");
{
p1 = 0;
p2 = 0;
p3 = 0;
p4 = 0;
p5 = 0;
fp = fopen("xuhao.txt", "rb");
if (fp == NULL)
{
printf("打开失败,请先录入信息\n");
printf("\n\n\n\t\t\t按任意键返回菜单");
getch();
menu();
break;
}
fread(&xuhao, sizeof(int), 1, fp);
xuhao = xuhao * 1 + 1;
fclose(fp);
printf("%d", xuhao - 1);
cos[i].num = xuhao - 1;
printf("\n");
printf("请输入编号(1苹果2香蕉3橘子4桃子5梨)与数量\n");
printf("选购结束请输入:0 0\n");
printf("============================================\n");
printf("水果种类 单价 数量 合计\n");
for (t = 1; t <= 6; t++)
{
scanf("%d%d", &A, &m);
switch (A) {
case 0:jieshu = 0; break;
case 1:printf("苹果 %.2f %d %.2f\n", price1, m, p1 = m*price1); strcat(cos[i].f.a, "苹果 5.00元/斤"); cos[i].g.a = m; break;
case 2:printf("香蕉 %.2f %d %.2f\n", price2, m, p2 = m*price2); strcat(cos[i].f.b, "香蕉 4.00元/斤"); cos[i].g.b = m; break;
case 3:printf("橘子 %.2f %d %.2f\n", price3, m, p3 = m*price3); strcat(cos[i].f.c, "橘子 3.00元/斤"); cos[i].g.c = m; break;
case 4:printf("桃子 %.2f %d %.2f\n", price4, m, p4 = m*price4); strcat(cos[i].f.d, "桃子 2.00元/斤"); cos[i].g.d = m; break;
case 5:printf("梨 %.2f %d %.2f\n", price5, m, p5 = m*price5); strcat(cos[i].f.e, "梨子 1.00元/斤"); cos[i].g.e = m; break;
default: {jieshu = 3; printf("商品错误\n"); } break;
}
if (jieshu == 3)
{
break;
}
if (jieshu == 0)
break;
}
if (jieshu == 3)
{
printf("\n\n\n\t\t\t按任意键返回菜单");
getch();
menu();
break;
}
H = p1 + p2 + p3 + p4 + p5;
if (H > 1000 || H <= 0)
{
printf("购买商品不在价格限额之内!");
printf("\n\n\n\t\t\t按任意键返回菜单");
getch();
menu();
break;
}
printf("============================================\n");
printf("合计:%.2f\n", H);
printf("请选择付款方式:1(现金支付)2(会员卡支付)\n3(进行会员卡充值并付款) 会员卡支付打8折!\n");
scanf("%d", &F);
if (F == 1)
{
printf("付款金额:");
scanf("%f", &M1);
strcpy(cos[i].zhifu, "现金");
M2 = M1 - H;
if (M2 >= 0)
printf("找零金额:%.2f\n", M2);
else {
printf("支付金额不足!");
printf("\n\n\n\t\t\t按任意键返回菜单");
getch();
menu();
break;
}
}
else if (F == 2)
{
printf("请输入会员卡号:");
scanf("%s", ch);
strcat(ch, ".txt");
fq = fopen(ch, "rb");
if (fq == NULL)
{
printf("会员卡不存在!");
printf("\n\n\n\t\t\t按任意键返回菜单");
getch();
menu();
break;
}
strcpy(cos[i].zhifu, "会员卡");
printf("原价:%.2f,会员价:%.2f\n", H, H*0.8);
/*strcat(cos[i].zhifu, ch);
strcat(cos[i].zhifu, "\n");*/
fread(&v1, sizeof(float), 1, fq);
printf("会员卡当前余额为:%.2f", v1);
money2 = v1 - H*0.8;
printf("支付后余额为:%.2f\n", money2);
fclose(fq);
fq = fopen(ch, "wb");
if (fq == NULL)
{
printf("文件打开错误!");
printf("\n\n\n\t\t\t按任意键返回菜单");
getch();
menu();
break;
}
fwrite(&money2, sizeof(float), 1, fq);
fclose(fq);
H = H*0.8;
}
else if (F == 3)
{
printf("请输入要充值的会员卡号:");
scanf("%s", ch);
strcat(ch, ".txt");
fq = fopen(ch, "rb");
if (fq == NULL)
{
printf("会员卡不存在!\n");
printf("请重新输入卡号:");
scanf("%s", ch);
strcat(ch, ".txt");
fq = fopen(ch, "rb");
if (fq == NULL)
{
printf("会员卡不存在!\n");
printf("请重新输入卡号:");
scanf("%s", ch);
strcat(ch, ".txt");
fq = fopen(ch, "rb");
if (fq == NULL)
{
printf("输入次数过多!\n");
printf("\n\n\n\t\t\t按任意键返回菜单");
getch();
menu();
break;
}
}
}
fread(&v1, sizeof(float), 1, fq);
fclose(fq);
strcpy(cos[i].zhifu, "会员卡");
printf("会员卡充值\n");
printf("请输入充值金额并输入任意符号表示结束:");
scanf("%f\n", &v2);
getchar();
printf("原价:%.2f,会员价:%.2f\n", H, H*0.8);
money2 = v1 + v2;
money2 = money2 - H;
fq = fopen(ch, "wb");
fwrite(&money2, sizeof(float), 1, fq);
printf("已自动支付!\n会员卡余额还有:");
printf("%.2f\n", money2);
fclose(fq);
H = H*0.8;
}
else {
printf("指令错误!");
printf("\n\n\n\t\t\t按任意键返回菜单");
getch();
menu();
break;
}
times = time(NULL);
tim = localtime(×);
strftime(timm, 64, "%Y-%m-%d %H:%M:%S", tim);
strcpy(cos[i].time, timm);
cos[i].heji = H;
fp = fopen("购物信息.txt", "ab");
if (fp == NULL)
{
printf("打开失败!\n");
printf("\n\n\n\t\t\t按任意键返回菜单");
getch();
menu();
break;
}
fwrite(&cos[i], sizeof(struct gouwu), 1, fp);
fclose(fp);
}
printf("------------------谢谢惠顾------------------\n");
fp = fopen("xuhao.txt", "wb");
if (fp == NULL)
{
printf("序号写入失败!\n");
printf("\n\n\n\t\t\t按任意键返回菜单");
getch();
menu();
break;
}
fwrite(&xuhao, sizeof(int), 1, fp);
fclose(fp);
printf("%s\n", cos[i].time);
printf("********************************************\n");
printf("下一单请输入:1\n");
printf("结束程序请输入:8\n");
scanf("%d", &jieshu);
if (jieshu == 8)
{
printf("\n\n\n\t\t\t按任意键返回菜单");
getch();
menu();
break;
}
else if (jieshu == 1)
jieshu = 1;
else
{
printf("输入错误!\n");
printf("\n\n\n\t\t\t按任意键返回菜单");
getch();
menu();
break;
}
}
}
void look() /*定义打印小票函数*/
{
system("CLS");
FILE *fp1, *fp;
char ch;
int sum, i, b, num[3] = { 0,0,0 };
fp = fopen("xuhao.txt", "rb");
if (fp == NULL)
{
printf("打开失败,请先录入信息\n");
printf("按任意键返回主菜单");
getch();
menu();
}
fread(&b, sizeof(int), 1, fp);
fclose(fp);
fp1 = fopen("购物信息.txt", "r");
if (fp1 == NULL)
{
printf("打开失败,请先录入信息
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
主要设计内容: 本系统主要分为水果类型管理模块、水果品种管理模块、进货管理模块、销售管理模块、报损管理模块、供货商管理模块、销售分析模块七大主要功能模块,各模块功能如下: 1.水果类型管理模块:添加水果类型,修改水果类型,删除水果类型 2.水果品种管理模块:添加水果品种,修改水果品种,删除水果品种 3.进货管理模块:添加进货信息,修改进货信息,删除进货信息 4.销售管理模块:添加销售信息,修改销售信息,删除销售信息 5.报损管理模块:添加报损信息,修改报损信息,删除报损信息 6.供货商管理模块:添加供货商信息,修改供货商信息,删除供货商信息 7.销售分析模块:查看库存信息,查看销售信息,查看进货信息,并具有各信息的排序功能及选择显示条数功能。
资源推荐
资源详情
资源评论
收起资源包目录
水果超市管理系统1.2.1.zip (34个子文件)
水果超市管理系统
0017.txt 4B
0010.txt 4B
0024.txt 4B
0020.txt 4B
0030.txt 4B
0001.txt 4B
0002.txt 4B
0019.txt 4B
0027.txt 4B
0026.txt 4B
0016.txt 4B
0012.txt 4B
0007.txt 4B
水果超市管理系统1.2.1.exe 181KB
0013.txt 4B
0029.txt 4B
0015.txt 4B
0028.txt 4B
0008.txt 4B
0023.txt 4B
0018.txt 4B
xuhao.txt 4B
0006.txt 4B
0014.txt 4B
序号文件打包.zip 4KB
0011.txt 4B
0021.txt 4B
0003.txt 4B
0025.txt 4B
源代码.txt 28KB
0005.txt 4B
0022.txt 4B
0009.txt 4B
0004.txt 4B
共 34 条
- 1
资源评论
u013574694
- 粉丝: 4
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功