|
|
@ -1,293 +1,625 @@
|
|
|
|
#include<stdio.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include<stdlib.h> /*其它说明*/
|
|
|
|
#include <windows.h>
|
|
|
|
#include<string.h> /*字符串函数*/
|
|
|
|
#include <string.h>
|
|
|
|
#include<Windows.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#define max 100
|
|
|
|
#include <stdlib.h>
|
|
|
|
#define LEN 15
|
|
|
|
|
|
|
|
#define N 50
|
|
|
|
|
|
|
|
int k = 1, n = 0, m = 0;
|
|
|
|
|
|
|
|
|
|
|
|
int bgnumber = 023; //客户号
|
|
|
|
typedef struct Bank {
|
|
|
|
int goodsn = 0; //商品量的统计
|
|
|
|
char no[13];//卡号
|
|
|
|
int ordern = 0; //订单的统计
|
|
|
|
char name[10];//姓名
|
|
|
|
|
|
|
|
char sex[8];//性别
|
|
|
|
|
|
|
|
int balance;//余额
|
|
|
|
void secondmain(); //管理维护子菜单
|
|
|
|
char passwd[20];
|
|
|
|
void shuru(); //输入商品
|
|
|
|
} bank, ban[max];
|
|
|
|
void browse(); //浏览商品
|
|
|
|
void fileWrite(int n, ban s);
|
|
|
|
void search(); //搜索商品
|
|
|
|
void modify() {
|
|
|
|
void order(); //订购商品
|
|
|
|
int j = 0;
|
|
|
|
void seek(); //查询订单
|
|
|
|
FILE * fp;
|
|
|
|
void add(); //增加商品
|
|
|
|
if ((fp = fopen("a.txt", "r")) == NULL) return;
|
|
|
|
void del(); //删除商品
|
|
|
|
ban s;
|
|
|
|
void savesp(); //保存商品
|
|
|
|
while (fscanf(fp, "%s %s %s %s %d ", &s[j].no, &s[j].name, &s[j].sex[j],&s[j].passwd, &s[j].balance) == 5) {
|
|
|
|
void savedd(); //保存订单
|
|
|
|
j++;
|
|
|
|
void daoru(); //从文本导入商品
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct goods {
|
|
|
|
|
|
|
|
char name[30]; //商品名
|
|
|
|
|
|
|
|
int number; //货号
|
|
|
|
|
|
|
|
char vender[30]; //厂家
|
|
|
|
|
|
|
|
char filed[100]; //产地
|
|
|
|
|
|
|
|
int stock; //库存
|
|
|
|
|
|
|
|
double unvalent; //单价
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct goods a[100];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct order {
|
|
|
|
|
|
|
|
int goodnumber; //货号
|
|
|
|
|
|
|
|
int ordernumber; //订购量
|
|
|
|
|
|
|
|
int ordertime; //日期时间
|
|
|
|
|
|
|
|
char customername[10]; //客户名
|
|
|
|
|
|
|
|
char customeraddress[100]; //客户地址
|
|
|
|
|
|
|
|
int customernumber; //客户编号
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
struct order b[100];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
|
|
|
|
printf(".. .. ......... .............. ........ .\n............ ... .. ....................@@\n.........@`..... .....................@@o \no.........@@.... ........@...... ..`@@@...\n.@@........@@..................O@O....@@ .......O@@@*... \n...@@O......@@@.....*O@@@@@@@@@@@..O@@@... ...@@@@o..... \n....@@@@`....@@@@@@@@@@@@@@@@@@@....@@......@@@@O....... \n.....@@@@/...@@@@............@*..O@@.....@@@@O......... \n........@@@@*..@@......oOOOO\\....@@@...*@@@@@.....o@.... \n.@@.......@@@@....@@@@@@@@@@@@@@@@@..O@@@@@....O@@@..... \n... @@@O....@@@@@@@@...........O@O.@@@@@@...@@@@O....... \n.. ...@@@@...O@@..... ... ......@@@@@@..@@@@@O......... \n ..O@@@...O*.....OOOO...@@@@@@..@@o..@@@. . . ... \n ......\\Oo...O@@@@@@@@@@@@@@..o.......@@O.. .... \n ...... ..O@@@@O.. ...O@@@*...........@@@.... \n . ... ..@@@@*.o@@/...@@@...@@@@....o@@.... \n............. .........O@@@@o..@@@..@@..@@...*@@*...... \n .... . ..... .......*..`@@*...@@@...@@@@....O@@.... . . \n............O......O@@@......@@@@...... ....@@@..... .. \n. ......O@@@..O@.o@@@@@@@@@@@@@*....... .. .@@O .. . \n......o..@@\\@@..@@@@o...oOOo................@@@. \n. ......@O@...@@@@.......... . ...o@......@@@.. \n . ....O^....@@@. ...... . .. .....*@@@O@@@@... \n............@@..... . ...... .. ......O@@@@O.... \n ../@ ... o@@@o... ....... \n .... .. ..\\@@@.. ....... \n ... .... .. .*@@@.... \n .... ... .. ....@@*.. \n");
|
|
|
|
|
|
|
|
Sleep(1000);
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
daoru();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
printf("\n\n\n\n\n\n");
|
|
|
|
|
|
|
|
printf("**************************欢迎使用商品订购系统**********************************\n");
|
|
|
|
|
|
|
|
printf(" 1.浏览商品信息 \n");
|
|
|
|
|
|
|
|
printf(" 2.订购商品 \n");
|
|
|
|
|
|
|
|
printf(" 3.订单查询 \n");
|
|
|
|
|
|
|
|
printf(" 4.搜索商品 \n");
|
|
|
|
|
|
|
|
printf(" 5.管理菜单 \n");
|
|
|
|
|
|
|
|
printf(" 0.退出系统 \n");
|
|
|
|
|
|
|
|
printf("********************************************************************************\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("\n\n 选择: ");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scanf("%d",&i);
|
|
|
|
|
|
|
|
switch(i) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
browse();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
order();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
seek();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
|
|
search();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
|
|
|
|
secondmain();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 0: //退出系统的界面
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
printf("\n\n\n\n\n\n\n\n");
|
|
|
|
|
|
|
|
printf("\n\n 欢迎使用本系统\n\n\n\n\n 欢迎再次使用\n");
|
|
|
|
|
|
|
|
exit(0);
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
printf("请从0-5中选择!!!");
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} while(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//浏览商品
|
|
|
|
|
|
|
|
void browse() {
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
printf(" 商品信息\n");
|
|
|
|
|
|
|
|
for (i = 0; i < goodsn; i++) {
|
|
|
|
|
|
|
|
printf("品名 : %s\n",a[i].name);
|
|
|
|
|
|
|
|
printf("货号 : %d\n",a[i].number);
|
|
|
|
|
|
|
|
printf("厂家 : %s\n",a[i].vender);
|
|
|
|
|
|
|
|
printf("产地 : %s\n",a[i].filed);
|
|
|
|
|
|
|
|
printf("库存 : %d\n",a[i].stock);
|
|
|
|
|
|
|
|
printf("单价 : %.2lf\n\n\n",a[i].unvalent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
n = j;
|
|
|
|
printf("\n\n\n\n\n\n ");
|
|
|
|
int i, item, num;
|
|
|
|
printf("返回主菜单\n");
|
|
|
|
int age;
|
|
|
|
printf(" ");
|
|
|
|
char sex1[8], s1[LEN + 1], s2[LEN + 1],passwd1[20],age1[10];
|
|
|
|
system("pause");
|
|
|
|
float score1;
|
|
|
|
return;
|
|
|
|
printf("请输入要修改的用户的卡号:\n");
|
|
|
|
}
|
|
|
|
scanf("%s", s1);
|
|
|
|
|
|
|
|
for (i = 0; i<n; i++) {
|
|
|
|
//商品的订购
|
|
|
|
if (strcmp(s[i].no, s1) == 0) { /*比较字符串是否相等*/
|
|
|
|
void order() {
|
|
|
|
num = i;
|
|
|
|
char ch;
|
|
|
|
printf("------------------\n");
|
|
|
|
int i, j, t, c = 1;
|
|
|
|
printf("1.修改姓名\n");
|
|
|
|
int n = 1;
|
|
|
|
printf("2.修改性别\n");
|
|
|
|
int m = 0;
|
|
|
|
printf("3.修改密码\n");
|
|
|
|
|
|
|
|
printf("4.退出本菜单\n");
|
|
|
|
do {
|
|
|
|
printf("------------------\n");
|
|
|
|
switch(n) {
|
|
|
|
while (1) {
|
|
|
|
case 1:
|
|
|
|
printf("请选择子菜单编号:");
|
|
|
|
system("cls");
|
|
|
|
scanf("%d", &item);
|
|
|
|
printf(" 商品信息\n");
|
|
|
|
switch (item) {
|
|
|
|
//显示商品的名称、货号信息,以便于订购
|
|
|
|
case 1:
|
|
|
|
printf("名称 货号 库存\n");
|
|
|
|
printf("请输入新的姓名:\n");
|
|
|
|
for (i = 0; i < goodsn; i++) {
|
|
|
|
scanf("%s", s2);
|
|
|
|
printf("%s %d %d\n\n\n",a[i].name,a[i].number,a[i].stock);
|
|
|
|
strcpy(s[num].name, s2);
|
|
|
|
|
|
|
|
fileWrite(n, s);
|
|
|
|
}
|
|
|
|
|
|
|
|
printf("\n\n\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf(" 商品订单\n");
|
|
|
|
|
|
|
|
printf("\n 请输入你的第%d个订单信息:\n",m + 1);
|
|
|
|
|
|
|
|
printf("\n 货号:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
scanf("%d",&b[ordern].goodnumber);
|
|
|
|
|
|
|
|
//检测是否含有此商品
|
|
|
|
|
|
|
|
j = 1;
|
|
|
|
|
|
|
|
for (i = 0; i < goodsn; i++) {
|
|
|
|
|
|
|
|
if(a[i].number == b[ordern].goodnumber) {
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
|
|
|
|
t = i;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//若有商品继续购买项目
|
|
|
|
|
|
|
|
if(j == 0) {
|
|
|
|
|
|
|
|
printf("\n 订购量:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
scanf("%d",&b[ordern].ordernumber);
|
|
|
|
|
|
|
|
if (a[t].stock >= b[ordern].ordernumber) {
|
|
|
|
|
|
|
|
a[t].stock = a[t].stock - b[ordern].ordernumber; //顾客购买后商品的库存计算
|
|
|
|
|
|
|
|
printf("\n 日期时间:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
scanf("%d",&b[ordern].ordertime);
|
|
|
|
|
|
|
|
printf("\n 客户名:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
gets(b[ordern].customername);
|
|
|
|
|
|
|
|
printf("\n 客户地址:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
gets(b[ordern].customeraddress);
|
|
|
|
|
|
|
|
printf("\n 客户编号:");
|
|
|
|
|
|
|
|
b[ordern].customernumber = bgnumber;
|
|
|
|
|
|
|
|
printf("%d\n",b[ordern].customernumber);
|
|
|
|
|
|
|
|
bgnumber++;
|
|
|
|
|
|
|
|
ordern++;
|
|
|
|
|
|
|
|
m++;
|
|
|
|
|
|
|
|
printf("\n\n\n ");
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
printf("\n\n 订购数目超出库存\n");
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//若没有商品的提示及操作
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
printf("\n\n 查无此货\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
printf("是否继续输入订购?(Y/N)");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
scanf("%c",&ch);
|
|
|
|
|
|
|
|
if(ch == 'N' || ch == 'n') {
|
|
|
|
|
|
|
|
c = 0;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
} else if(ch == 'Y' || ch == 'y') {
|
|
|
|
printf("请输入新的性别:\n");
|
|
|
|
c = 0;
|
|
|
|
scanf("%s", &sex1);
|
|
|
|
n = 1;
|
|
|
|
strcpy(s[num].sex, sex1);
|
|
|
|
|
|
|
|
fileWrite(n, s);
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
} else if(ch != 'n' || ch != 'N' || ch != 'Y' || ch != 'y') {
|
|
|
|
printf("请输入新的密码:\n");
|
|
|
|
n = 0;
|
|
|
|
scanf("%s", &passwd1);
|
|
|
|
c = 1;
|
|
|
|
strcpy(s[num].passwd, passwd1);
|
|
|
|
|
|
|
|
fileWrite(n, s);
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
printf("请在1-4之间选择\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
case 0:
|
|
|
|
else {
|
|
|
|
if(c == 1) {
|
|
|
|
printf("没有该卡号!!!\n");
|
|
|
|
n = 2;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
} while(ch != 'n' && ch != 'N');
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void insert() {
|
|
|
|
|
|
|
|
int i, a, b;
|
|
|
|
//订单的查询
|
|
|
|
printf("请输入待增加的用户数:\n");
|
|
|
|
void seek() {
|
|
|
|
scanf("%d", &n);
|
|
|
|
int i;
|
|
|
|
FILE * fp;
|
|
|
|
system("cls");
|
|
|
|
if ((fp = fopen("a.txt", "at")) == NULL) return;
|
|
|
|
printf(" 订单列表\n");
|
|
|
|
ban s;
|
|
|
|
for (i = 0; i < ordern; i++) {
|
|
|
|
for (i = 0; i<n; i++) {
|
|
|
|
printf("货号 : %d\n",b[i].goodnumber);
|
|
|
|
printf("\n请输入第%d个用户的卡号:", i + 1);
|
|
|
|
printf("订购量 : %d\n",b[i].ordernumber);
|
|
|
|
scanf("\n%s", &s[i].no);
|
|
|
|
printf("日期时间 : %d\n",b[i].ordertime);
|
|
|
|
printf("\n请输入第%d个用户的姓名:", i + 1);
|
|
|
|
printf("客户名 : %s\n",b[i].customername);
|
|
|
|
scanf("%s", &s[i].name);
|
|
|
|
printf("客户地址 : %s\n",b[i].customeraddress);
|
|
|
|
printf("\n请输入第%d 个用户的性别:", i + 1);
|
|
|
|
printf("客户编号 : %d\n\n\n",b[i].customernumber);
|
|
|
|
scanf("%s", &s[i].sex);
|
|
|
|
|
|
|
|
printf("\n请输入第%d 个用户的密码:", i + 1);
|
|
|
|
|
|
|
|
scanf("%s", &s[i].passwd);
|
|
|
|
|
|
|
|
//写入文件
|
|
|
|
|
|
|
|
fseek(fp, 0L, SEEK_END);
|
|
|
|
|
|
|
|
fprintf(fp, "%s %s %s %s %d \n", s[i].no, s[i].name, s[i].sex,s[i].passwd, s[i].balance = 0);
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printf("添加成功!!!\n");
|
|
|
|
printf("\n\n\n\n\n\n ");
|
|
|
|
|
|
|
|
printf("返回主菜单\n");
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
system("pause");
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//增加商品
|
|
|
|
|
|
|
|
void add() {
|
|
|
|
|
|
|
|
char ch;
|
|
|
|
|
|
|
|
int i=1;
|
|
|
|
|
|
|
|
int n = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
|
|
|
switch(n) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
printf(" 商品信息的增加\n");
|
|
|
|
|
|
|
|
printf("\n 请输入你的第%d件商品的信息:\n",i);
|
|
|
|
|
|
|
|
printf("\n 名称:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
scanf("%s",a[goodsn].name);
|
|
|
|
|
|
|
|
printf("\n 货号:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
scanf("%d",&a[goodsn].number);
|
|
|
|
|
|
|
|
printf("\n 厂家:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
scanf("%s",a[goodsn].vender);
|
|
|
|
|
|
|
|
printf("\n 产地:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
scanf("%s",a[goodsn].filed);
|
|
|
|
|
|
|
|
printf("\n 库存:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
scanf("%d",&a[goodsn].stock);
|
|
|
|
|
|
|
|
printf("\n 单价:");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
scanf("%lf",&a[goodsn].unvalent);
|
|
|
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
goodsn++;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
printf("是否继续输入记录?(Y/N)");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
scanf("%c",&ch);
|
|
|
|
|
|
|
|
if(ch ==' Y'|| ch == 'y') {
|
|
|
|
|
|
|
|
n = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ch == 'N' || ch ==' Y'|| ch == 'n'|| ch == 'y') {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} while(ch != 'n' && ch != 'N');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//删除商品
|
|
|
|
void del() {
|
|
|
|
void del() {
|
|
|
|
int j = 0;
|
|
|
|
int i;
|
|
|
|
FILE * fp, *fp1;
|
|
|
|
int j;
|
|
|
|
if ((fp = fopen("a.txt", "r")) == NULL) return;
|
|
|
|
char ch;
|
|
|
|
ban s;
|
|
|
|
int n = 1;
|
|
|
|
while (fscanf(fp, "%s %s %s %s %d ", &s[j].no, &s[j].name, &s[j].sex[j],&s[j].passwd, &s[j].balance) == 5) {
|
|
|
|
|
|
|
|
j++;
|
|
|
|
do {
|
|
|
|
}
|
|
|
|
switch(n) {
|
|
|
|
n = j;
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
int i, flag = 0;
|
|
|
|
printf(" 商品列表\n");
|
|
|
|
char s1[LEN + 1];
|
|
|
|
//显示商品的名称、货号信息,以便于下部的删除
|
|
|
|
printf("请输入要删除用户的卡号:\n");
|
|
|
|
for (i = 0; i < goodsn; i++) {
|
|
|
|
scanf("%s", s1);
|
|
|
|
printf("名称 : %s\n",a[i].name);
|
|
|
|
for (i = 0; i<n; i++) {
|
|
|
|
printf("ID : %d\n",i);
|
|
|
|
if (strcmp(s[i].no, s1) == 0) {
|
|
|
|
printf("库存 : %d\n\n\n",a[i].stock);
|
|
|
|
flag = 1;
|
|
|
|
}
|
|
|
|
for (j = i; j<n - 1; j++) {
|
|
|
|
|
|
|
|
strcpy(s[j].no, s[j + 1].no);
|
|
|
|
//商品的搜索
|
|
|
|
strcpy(s[j].name, s[j + 1].name);
|
|
|
|
printf("\n\n\n 请输入你要删除商品的ID:");
|
|
|
|
s[j].balance = s[j + 1].balance;
|
|
|
|
scanf("%d",&j);
|
|
|
|
strcpy(s[j].sex, s[j + 1].sex);
|
|
|
|
i = j;
|
|
|
|
strcpy(s[j].passwd, s[j + 1].passwd);
|
|
|
|
while(i < goodsn - 1) {
|
|
|
|
}
|
|
|
|
strcpy(a[i].name, a[i + 1].name);
|
|
|
|
|
|
|
|
a[i].number = a[i + 1].number;
|
|
|
|
|
|
|
|
strcpy(a[i].filed, a[i + 1].filed);
|
|
|
|
|
|
|
|
a[i].stock = a[i + 1].stock;
|
|
|
|
|
|
|
|
a[i].unvalent = a[i + 1].unvalent;
|
|
|
|
|
|
|
|
strcpy(a[i].vender, a[i + 1].vender);
|
|
|
|
|
|
|
|
i++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
goodsn--;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
printf("是否继续删除商品?(Y/N)");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
scanf("%c",&ch);
|
|
|
|
|
|
|
|
if(ch == 'N' || ch ==' Y'|| ch == 'n'|| ch == 'y') {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ch ==' Y'|| ch == 'y') {
|
|
|
|
|
|
|
|
n = 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("是否继续输入记录?(Y/N)");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
scanf("%c",&ch);
|
|
|
|
|
|
|
|
n = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while(ch != 'n' && ch != 'N');
|
|
|
|
if (flag == 0)
|
|
|
|
|
|
|
|
printf("该卡号不存在!\n");
|
|
|
|
|
|
|
|
if (flag == 1) {
|
|
|
|
|
|
|
|
n--;
|
|
|
|
|
|
|
|
fileWrite(n, s);
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
printf("删除成功,显示结果请选择菜单\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
printf("\n\n\n\n\n\n ");
|
|
|
|
|
|
|
|
printf("返回附加功能菜单\n");
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
system("pause");
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void seek() {
|
|
|
|
|
|
|
|
int j = 0,flag=0;
|
|
|
|
//商品信息的保存
|
|
|
|
FILE * fp;
|
|
|
|
void savesp() {
|
|
|
|
if ((fp = fopen("a.txt", "r")) == NULL) return;
|
|
|
|
FILE *fp;
|
|
|
|
ban s;
|
|
|
|
int i;
|
|
|
|
while (fscanf(fp, "%s %s %s %s %d", &s[j].no, &s[j].name, &s[j].sex[j], &s[j].passwd, &s[j].balance) == 5) {
|
|
|
|
|
|
|
|
j++;
|
|
|
|
fp = fopen("spxx.txt","w");
|
|
|
|
}
|
|
|
|
assert(fp != NULL);
|
|
|
|
n = j;
|
|
|
|
|
|
|
|
int i = 0, item;
|
|
|
|
fprintf(fp," 商品信息列表\n");
|
|
|
|
char s1[13], s2[20];
|
|
|
|
//商品信息的录入
|
|
|
|
lable1:
|
|
|
|
for (i = 0; i < goodsn; i++) {
|
|
|
|
printf("请输入卡号(输入0返回主菜单):\n");
|
|
|
|
fprintf(fp,"名称: %s\n",a[i].name);
|
|
|
|
scanf("%s", &s1);
|
|
|
|
fprintf(fp,"货号: %d\n",a[i].number);
|
|
|
|
if (strcmp(s1, "0") == 0)
|
|
|
|
fprintf(fp,"厂家: %s\n",a[i].vender);
|
|
|
|
{
|
|
|
|
fprintf(fp,"产地: %s\n",a[i].filed);
|
|
|
|
return;
|
|
|
|
fprintf(fp,"库存: %d\n",a[i].stock);
|
|
|
|
}
|
|
|
|
fprintf(fp,"单价: %.2lf\n\n\n",a[i].unvalent);
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
|
|
|
|
if (strcmp(s[i].no, s1) == 0) {
|
|
|
|
|
|
|
|
printf("请输入密码:\n");
|
|
|
|
|
|
|
|
scanf("%s", &s2);
|
|
|
|
|
|
|
|
if (strcmp(s[i].passwd, s2) == 0) {
|
|
|
|
|
|
|
|
printf("您查询的账户信息如下\n");
|
|
|
|
|
|
|
|
printf("卡号:%s\n", s[i].no);
|
|
|
|
|
|
|
|
printf("姓名:%s\n", s[i].name);
|
|
|
|
|
|
|
|
printf("性别:%s\n", s[i].sex);
|
|
|
|
|
|
|
|
printf("余额:%d\n", s[i].balance);
|
|
|
|
|
|
|
|
flag = 2;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
printf("您输入的密码错误,请重新输入\n");
|
|
|
|
|
|
|
|
goto lable1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag != 2) {
|
|
|
|
|
|
|
|
printf("您输入的用户名不存在,请重新输入\n");
|
|
|
|
|
|
|
|
goto lable1;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
printf("\n\n\n\n\n\n 商品信息保存成功!!!\n");
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
system("pause");
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void save()
|
|
|
|
|
|
|
|
{
|
|
|
|
//订单的保存信息
|
|
|
|
int j = 0,flag=0;
|
|
|
|
void savedd() {
|
|
|
|
FILE * fp;
|
|
|
|
FILE *fp;
|
|
|
|
if ((fp = fopen("a.txt", "r+")) == NULL) return;
|
|
|
|
int i;
|
|
|
|
ban s;
|
|
|
|
|
|
|
|
while (fscanf(fp, "%s %s %s %s %d", &s[j].no, &s[j].name, &s[j].sex[j], &s[j].passwd, &s[j].balance) == 5) {
|
|
|
|
fp = fopen("ddxx.txt","w");
|
|
|
|
j++;
|
|
|
|
assert(fp != NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
n = j;
|
|
|
|
fprintf(fp," 订单列表\n");
|
|
|
|
struct Bank *str = s;
|
|
|
|
//商品信息的录入
|
|
|
|
int i = 0, item,save,aftersave;
|
|
|
|
for (i = 0; i < ordern; i++) {
|
|
|
|
char s1[13], s2[20];
|
|
|
|
fprintf(fp,"货号 :%d\n",b[i].goodnumber);
|
|
|
|
lable1:
|
|
|
|
fprintf(fp,"订购量 :%d\n",b[i].ordernumber);
|
|
|
|
printf("请输入卡号(输入0返回主菜单):\n");
|
|
|
|
fprintf(fp,"日期时间 :%d\n",b[i].ordertime);
|
|
|
|
scanf("%s", &s1);
|
|
|
|
fprintf(fp,"客户名 :%s\n",b[i].customername);
|
|
|
|
if (strcmp(s1, "0") == 0)
|
|
|
|
fprintf(fp,"客户地址 :%s\n",b[i].customeraddress);
|
|
|
|
{
|
|
|
|
fprintf(fp,"客户号 :%d\n\n\n",b[i].customernumber);
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
|
|
|
|
if (strcmp(s[i].no, s1) == 0) {
|
|
|
|
|
|
|
|
printf("请输入密码:\n");
|
|
|
|
|
|
|
|
scanf("%s", &s2);
|
|
|
|
|
|
|
|
if (strcmp(s[i].passwd, s2) == 0) {
|
|
|
|
|
|
|
|
printf("请输入您要存款的金额:");
|
|
|
|
|
|
|
|
scanf("%d",&save);
|
|
|
|
|
|
|
|
s[i].balance = save + s[i].balance;
|
|
|
|
|
|
|
|
fileWrite(n, s);
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
printf("存款成功!\n");
|
|
|
|
|
|
|
|
printf("当前余额为%d元\n",s[i].balance);
|
|
|
|
|
|
|
|
flag = 2;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
printf("您输入的密码错误,请重新输入\n");
|
|
|
|
|
|
|
|
goto lable1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flag != 2) {
|
|
|
|
|
|
|
|
printf("您输入的用户名不存在,请重新输入\n");
|
|
|
|
|
|
|
|
goto lable1;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保存后信息的反馈
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
printf("\n\n\n\n\n\n 信息保存成功!!!\n");
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
system("pause");
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void fileWrite(int n, ban s) {
|
|
|
|
|
|
|
|
FILE *fp1;
|
|
|
|
//管理维护子菜单
|
|
|
|
|
|
|
|
void secondmain() {
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
if ((fp1 = fopen("a.txt", "w")) == NULL) return;
|
|
|
|
|
|
|
|
for (i = 0; i<n; i++) {
|
|
|
|
|
|
|
|
fprintf(fp1, "%s %s %s %s %d ", s[i].no, s[i].name, s[i].sex,s[i].passwd, s[i].balance);
|
|
|
|
do {
|
|
|
|
}
|
|
|
|
system("cls");
|
|
|
|
fclose(fp1);
|
|
|
|
printf("\n\n\n\n\n\n\n");
|
|
|
|
|
|
|
|
printf("********************************管理子菜单************************************\n\n");
|
|
|
|
|
|
|
|
printf(" 1.输入全部商品 \n");
|
|
|
|
|
|
|
|
printf(" 2.增加商品 \n");
|
|
|
|
|
|
|
|
printf(" 3.删除商品 \n");
|
|
|
|
|
|
|
|
printf(" 4.储存商品 \n");
|
|
|
|
|
|
|
|
printf(" 5.储存订单 \n");
|
|
|
|
|
|
|
|
printf(" 0.返回上一级 \n");
|
|
|
|
|
|
|
|
printf("**************************************************************************\n\n\n\n\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("\n\n 请输入你所要选择的功能(0~5): ");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scanf("%d",&i);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch(i) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
shuru ();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
add();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
del();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
savesp();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
savedd();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} while(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* 界面*/
|
|
|
|
|
|
|
|
void menu() {
|
|
|
|
//从键盘输入商品
|
|
|
|
int num;
|
|
|
|
void shuru() {
|
|
|
|
printf("------------------------------------------------------\n");
|
|
|
|
char ch;
|
|
|
|
printf("------------------------------------------------------\n");
|
|
|
|
int n = 1;
|
|
|
|
printf("-------------------银行管理系统-----------------------\n");
|
|
|
|
goodsn = 0;
|
|
|
|
printf("------------------------------------------------------\n");
|
|
|
|
|
|
|
|
printf("------------------------------------------------------\n");
|
|
|
|
do {
|
|
|
|
Sleep(3000);
|
|
|
|
switch(n) {
|
|
|
|
system("CLS");
|
|
|
|
case 1:
|
|
|
|
printf("------------------------------------------------------\n");
|
|
|
|
//商品的录入
|
|
|
|
printf("----------------------请选择功能----------------------\n");
|
|
|
|
system("cls");
|
|
|
|
printf("-------------------1.查询 2.存款--------------------\n");
|
|
|
|
printf(" 请重新输入全部商品信息\n");
|
|
|
|
printf("-------------------3.取款 4.开户--------------------\n");
|
|
|
|
printf("\n 请输入第%d件商品的信息:\n",goodsn + 1);
|
|
|
|
printf("-------------------5.销户 6.账户信息修改------------\n");
|
|
|
|
printf("\n 名称:");
|
|
|
|
printf("-----------------------0.退出-------------------------\n");
|
|
|
|
fflush(stdin);
|
|
|
|
printf("请选择菜单编号:");
|
|
|
|
gets(a[goodsn].name);
|
|
|
|
scanf("%d", &num);
|
|
|
|
printf("\n 货号:");
|
|
|
|
switch (num) {
|
|
|
|
fflush(stdin);
|
|
|
|
case 0:
|
|
|
|
scanf("%d",&a[goodsn].number);
|
|
|
|
exit(0);
|
|
|
|
printf("\n 厂家:");
|
|
|
|
break;
|
|
|
|
fflush(stdin);
|
|
|
|
case 1:
|
|
|
|
gets(a[goodsn].vender);
|
|
|
|
seek();
|
|
|
|
printf("\n 产地:");
|
|
|
|
break;
|
|
|
|
fflush(stdin);
|
|
|
|
case 2:
|
|
|
|
gets(a[goodsn].filed);
|
|
|
|
save();
|
|
|
|
printf("\n 库存:");
|
|
|
|
break;
|
|
|
|
fflush(stdin);
|
|
|
|
case 3:
|
|
|
|
scanf("%d",&a[goodsn].stock);
|
|
|
|
break;
|
|
|
|
printf("\n 单价:");
|
|
|
|
case 4:
|
|
|
|
fflush(stdin);
|
|
|
|
insert();
|
|
|
|
scanf("%lf",&a[goodsn].unvalent);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
goodsn++;
|
|
|
|
del();
|
|
|
|
|
|
|
|
break;
|
|
|
|
fflush(stdin);
|
|
|
|
case 6:
|
|
|
|
case 2:
|
|
|
|
modify();
|
|
|
|
printf("是否继续输入记录?(Y/N)");
|
|
|
|
break;
|
|
|
|
fflush(stdin);
|
|
|
|
default:
|
|
|
|
scanf("%c",&ch);
|
|
|
|
printf("请在0-6之间选择\n");
|
|
|
|
if(ch == 'N' || ch ==' Y'|| ch == 'n'|| ch == 'y') {
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ch ==' Y'|| ch == 'y') {
|
|
|
|
|
|
|
|
n = 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("是否继续输入记录?(Y/N)");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
scanf("%c",&ch);
|
|
|
|
|
|
|
|
n = 2;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} while(ch != 'n' && ch != 'N');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//导入商品信息
|
|
|
|
|
|
|
|
void daoru() {
|
|
|
|
|
|
|
|
FILE *fp;
|
|
|
|
|
|
|
|
char ch[30];
|
|
|
|
|
|
|
|
double dou;
|
|
|
|
|
|
|
|
int in;
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
goodsn = 0;
|
|
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
fp = fopen("spxx.txt","r");
|
|
|
|
while (k) {
|
|
|
|
assert(fp);
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
menu();
|
|
|
|
//从文件中导入商品信息
|
|
|
|
|
|
|
|
fscanf(fp,"%s",&ch);
|
|
|
|
|
|
|
|
while(fscanf(fp,"%s",&ch) != EOF) {
|
|
|
|
|
|
|
|
fscanf(fp, "%s", &ch);
|
|
|
|
|
|
|
|
strcpy(a[goodsn].name, ch);
|
|
|
|
|
|
|
|
fscanf(fp,"%s",&ch);
|
|
|
|
|
|
|
|
fscanf(fp,"%d",&in);
|
|
|
|
|
|
|
|
a[goodsn].number = in;
|
|
|
|
|
|
|
|
fscanf(fp,"%s",&ch);
|
|
|
|
|
|
|
|
fscanf(fp,"%s",&ch);
|
|
|
|
|
|
|
|
strcpy(a[goodsn].vender, ch);
|
|
|
|
|
|
|
|
fscanf(fp,"%s",&ch);
|
|
|
|
|
|
|
|
fscanf(fp,"%s",&ch);
|
|
|
|
|
|
|
|
strcpy(a[goodsn].filed, ch);
|
|
|
|
|
|
|
|
fscanf(fp,"%s",&ch);
|
|
|
|
|
|
|
|
fscanf(fp,"%d",&in);
|
|
|
|
|
|
|
|
a[goodsn].stock = in;
|
|
|
|
|
|
|
|
fscanf(fp,"%s",&ch);
|
|
|
|
|
|
|
|
fscanf(fp,"%lf",&dou);
|
|
|
|
|
|
|
|
a[goodsn].unvalent = dou;
|
|
|
|
|
|
|
|
goodsn++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fclose (fp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//搜索商品
|
|
|
|
|
|
|
|
void search() {
|
|
|
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
int j;
|
|
|
|
|
|
|
|
char ch;
|
|
|
|
|
|
|
|
int n = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
|
|
|
switch(n) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
printf(" 商品列表\n");
|
|
|
|
|
|
|
|
//显示商品的名称、货号信息,以便于下部的删除
|
|
|
|
|
|
|
|
for (i = 0; i < goodsn; i++) {
|
|
|
|
|
|
|
|
printf("名称 : %s\n",a[i].name);
|
|
|
|
|
|
|
|
printf("ID : %d\n",i);
|
|
|
|
|
|
|
|
printf("库存 : %d\n\n\n",a[i].stock);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//商品的搜索
|
|
|
|
|
|
|
|
printf("\n\n\n 请输入你要搜索商品的ID:");
|
|
|
|
|
|
|
|
scanf("%d",&j);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(0<=j&&j<=goodsn) {
|
|
|
|
|
|
|
|
printf("名称 : %s\n",a[j].name);
|
|
|
|
|
|
|
|
printf("货号 : %d\n",a[j].number);
|
|
|
|
|
|
|
|
printf("厂家 : %s\n",a[j].vender);
|
|
|
|
|
|
|
|
printf("产地 : %s\n",a[j].filed);
|
|
|
|
|
|
|
|
printf("库存 : %d\n",a[j].stock);
|
|
|
|
|
|
|
|
printf("单价 : %.2lf\n\n\n",a[j].unvalent);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
printf("是否继续搜索商品?(Y/N)");
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
scanf("%c",&ch);
|
|
|
|
|
|
|
|
if(ch == 'N'|| ch == 'n') {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ch ==' Y'|| ch == 'y') {
|
|
|
|
|
|
|
|
n = 1;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} while(ch != 'n' && ch != 'N');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("\n\n\n\n\n\n ");
|
|
|
|
|
|
|
|
printf("返回主菜单!\n");
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
system("pause");
|
|
|
|
system("pause");
|
|
|
|
return 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|