|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int bgnumber = 023; //<2F>ͻ<EFBFBD><CDBB><EFBFBD>
|
|
|
|
|
int goodsn = 0; //<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>
|
|
|
|
|
int ordern = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void secondmain(); //<2F><><EFBFBD><EFBFBD>ά<EFBFBD><CEAC><EFBFBD>Ӳ˵<D3B2>
|
|
|
|
|
void shuru(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
|
|
|
|
|
void browse(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
|
|
|
|
|
void search(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
|
|
|
|
|
void order(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
|
|
|
|
|
void seek(); //<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
|
|
|
|
|
void add(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
|
|
|
|
|
void del(); //ɾ<><C9BE><EFBFBD><EFBFBD>Ʒ
|
|
|
|
|
void savesp(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
|
|
|
|
|
void savedd(); //<2F><><EFBFBD>涩<EFBFBD><E6B6A9>
|
|
|
|
|
void daoru(); //<2F><><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
|
|
|
|
|
|
|
|
|
|
struct goods {
|
|
|
|
|
char name[30]; //<2F><>Ʒ<EFBFBD><C6B7>
|
|
|
|
|
int number; //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
char vender[30]; //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
char filed[100]; //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
int stock; //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
double unvalent; //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
};
|
|
|
|
|
struct goods a[100];
|
|
|
|
|
|
|
|
|
|
struct order {
|
|
|
|
|
int goodnumber; //<2F><><EFBFBD><EFBFBD>
|
|
|
|
|
int ordernumber; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
int ordertime; //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
|
|
|
|
char customername[10]; //<2F>ͻ<EFBFBD><CDBB><EFBFBD>
|
|
|
|
|
char customeraddress[100]; //<2F>ͻ<EFBFBD><CDBB><EFBFBD>ַ
|
|
|
|
|
int customernumber; //<2F>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
};
|
|
|
|
|
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("**************************<2A><>ӭʹ<D3AD><CAB9><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>ϵͳ**********************************\n");
|
|
|
|
|
printf(" 1.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>Ϣ \n");
|
|
|
|
|
printf(" 2.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ \n");
|
|
|
|
|
printf(" 3.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ \n");
|
|
|
|
|
printf(" 4.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ \n");
|
|
|
|
|
printf(" 5.<2E><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD> \n");
|
|
|
|
|
printf(" 0.<2E>˳<EFBFBD>ϵͳ \n");
|
|
|
|
|
printf("********************************************************************************\n");
|
|
|
|
|
|
|
|
|
|
printf("\n\n ѡ<><D1A1>: ");
|
|
|
|
|
|
|
|
|
|
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: //<2F>˳<EFBFBD>ϵͳ<CFB5>Ľ<EFBFBD><C4BD><EFBFBD>
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("\n\n\n\n\n\n\n\n");
|
|
|
|
|
printf("\n\n <20><>ӭʹ<D3AD>ñ<EFBFBD>ϵͳ\n\n\n\n\n <20><>ӭ<EFBFBD>ٴ<EFBFBD>ʹ<EFBFBD><CAB9>\n");
|
|
|
|
|
exit(0);
|
|
|
|
|
default:
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>0-5<><35>ѡ<EFBFBD><EFBFBD><F1A3A1A3><EFBFBD>");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} while(1);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
|
|
|
|
|
void browse() {
|
|
|
|
|
int i;
|
|
|
|
|
system("cls");
|
|
|
|
|
printf(" <20><>Ʒ<EFBFBD><C6B7>Ϣ\n");
|
|
|
|
|
for (i = 0; i < goodsn; i++) {
|
|
|
|
|
printf("Ʒ<EFBFBD><EFBFBD> : %s\n",a[i].name);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %d\n",a[i].number);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %s\n",a[i].vender);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %s\n",a[i].filed);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %d\n",a[i].stock);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %.2lf\n\n\n",a[i].unvalent);
|
|
|
|
|
}
|
|
|
|
|
printf("\n\n\n\n\n\n ");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
system("pause");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>Ʒ<EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD>
|
|
|
|
|
void order() {
|
|
|
|
|
char ch;
|
|
|
|
|
int i, j, t, c = 1;
|
|
|
|
|
int n = 1;
|
|
|
|
|
int m = 0;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
switch(n) {
|
|
|
|
|
case 1:
|
|
|
|
|
system("cls");
|
|
|
|
|
printf(" <20><>Ʒ<EFBFBD><C6B7>Ϣ\n");
|
|
|
|
|
//<2F><>ʾ<EFBFBD><CABE>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD><C6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Ա<EFBFBD><D4B1>ڶ<EFBFBD><DAB6><EFBFBD>
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>\n");
|
|
|
|
|
for (i = 0; i < goodsn; i++) {
|
|
|
|
|
printf("%s %d %d\n\n\n",a[i].name,a[i].number,a[i].stock);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
printf("\n\n\n");
|
|
|
|
|
|
|
|
|
|
printf(" <20><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ:\n",m + 1);
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%d",&b[ordern].goodnumber);
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>Ʒ
|
|
|
|
|
j = 1;
|
|
|
|
|
for (i = 0; i < goodsn; i++) {
|
|
|
|
|
if(a[i].number == b[ordern].goodnumber) {
|
|
|
|
|
j = 0;
|
|
|
|
|
t = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
|
|
|
|
|
if(j == 0) {
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%d",&b[ordern].ordernumber);
|
|
|
|
|
if (a[t].stock >= b[ordern].ordernumber) {
|
|
|
|
|
a[t].stock = a[t].stock - b[ordern].ordernumber; //<2F>˿<CBBF><CDB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%d",&b[ordern].ordertime);
|
|
|
|
|
printf("\n <20>ͻ<EFBFBD><CDBB><EFBFBD>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
gets(b[ordern].customername);
|
|
|
|
|
printf("\n <20>ͻ<EFBFBD><CDBB><EFBFBD>ַ:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
gets(b[ordern].customeraddress);
|
|
|
|
|
printf("\n <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>:");
|
|
|
|
|
b[ordern].customernumber = bgnumber;
|
|
|
|
|
printf("%d\n",b[ordern].customernumber);
|
|
|
|
|
bgnumber++;
|
|
|
|
|
ordern++;
|
|
|
|
|
m++;
|
|
|
|
|
printf("\n\n\n ");
|
|
|
|
|
system("pause");
|
|
|
|
|
} else {
|
|
|
|
|
printf("\n\n <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
system("pause");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//<2F><>û<EFBFBD><C3BB><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
else {
|
|
|
|
|
printf("\n\n <20><><EFBFBD>˻<DEB4>\n");
|
|
|
|
|
|
|
|
|
|
printf(" ");
|
|
|
|
|
system("pause");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>붩<EFBFBD><EFBFBD>?(Y/N)");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%c",&ch);
|
|
|
|
|
if(ch == 'N' || ch == 'n') {
|
|
|
|
|
c = 0;
|
|
|
|
|
break;
|
|
|
|
|
} else if(ch == 'Y' || ch == 'y') {
|
|
|
|
|
c = 0;
|
|
|
|
|
n = 1;
|
|
|
|
|
break;
|
|
|
|
|
} else if(ch != 'n' || ch != 'N' || ch != 'Y' || ch != 'y') {
|
|
|
|
|
n = 0;
|
|
|
|
|
c = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case 0:
|
|
|
|
|
if(c == 1) {
|
|
|
|
|
n = 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} while(ch != 'n' && ch != 'N');
|
|
|
|
|
system("cls");
|
|
|
|
|
|
|
|
|
|
return ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD>ѯ
|
|
|
|
|
void seek() {
|
|
|
|
|
int i;
|
|
|
|
|
system("cls");
|
|
|
|
|
printf(" <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>\n");
|
|
|
|
|
for (i = 0; i < ordern; i++) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %d\n",b[i].goodnumber);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %d\n",b[i].ordernumber);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> : %d\n",b[i].ordertime);
|
|
|
|
|
printf("<EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD> : %s\n",b[i].customername);
|
|
|
|
|
printf("<EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD>ַ : %s\n",b[i].customeraddress);
|
|
|
|
|
printf("<EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %d\n\n\n",b[i].customernumber);
|
|
|
|
|
}
|
|
|
|
|
printf("\n\n\n\n\n\n ");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
system("pause");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
|
|
|
|
|
void add() {
|
|
|
|
|
char ch;
|
|
|
|
|
int i=1;
|
|
|
|
|
int n = 1;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
switch(n) {
|
|
|
|
|
case 1:
|
|
|
|
|
system("cls");
|
|
|
|
|
printf(" <20><>Ʒ<EFBFBD><C6B7>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>%d<><64><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>Ϣ:\n",i);
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%s",a[goodsn].name);
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%d",&a[goodsn].number);
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%s",a[goodsn].vender);
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%s",a[goodsn].filed);
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%d",&a[goodsn].stock);
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%lf",&a[goodsn].unvalent);
|
|
|
|
|
i++;
|
|
|
|
|
goodsn++;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼?(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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//ɾ<><C9BE><EFBFBD><EFBFBD>Ʒ
|
|
|
|
|
void del() {
|
|
|
|
|
int i;
|
|
|
|
|
int j;
|
|
|
|
|
char ch;
|
|
|
|
|
int n = 1;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
switch(n) {
|
|
|
|
|
case 1:
|
|
|
|
|
system("cls");
|
|
|
|
|
printf(" <20><>Ʒ<EFBFBD>б<EFBFBD>\n");
|
|
|
|
|
//<2F><>ʾ<EFBFBD><CABE>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD><C6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>²<EFBFBD><C2B2><EFBFBD>ɾ<EFBFBD><C9BE>
|
|
|
|
|
for (i = 0; i < goodsn; i++) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %s\n",a[i].name);
|
|
|
|
|
printf("ID : %d\n",i);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %d\n\n\n",a[i].stock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
printf("\n\n\n <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>ID:");
|
|
|
|
|
scanf("%d",&j);
|
|
|
|
|
i = j;
|
|
|
|
|
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("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ?(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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} while(ch != 'n' && ch != 'N');
|
|
|
|
|
|
|
|
|
|
printf("\n\n\n\n\n\n ");
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD>ӹ<EFBFBD><EFBFBD>ܲ˵<EFBFBD>\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
system("pause");
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>Ʒ<EFBFBD><C6B7>Ϣ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>
|
|
|
|
|
void savesp() {
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
fp = fopen("spxx.txt","w");
|
|
|
|
|
assert(fp != NULL);
|
|
|
|
|
|
|
|
|
|
fprintf(fp," <20><>Ʒ<EFBFBD><C6B7>Ϣ<EFBFBD>б<EFBFBD>\n");
|
|
|
|
|
//<2F><>Ʒ<EFBFBD><C6B7>Ϣ<EFBFBD><CFA2>¼<EFBFBD><C2BC>
|
|
|
|
|
for (i = 0; i < goodsn; i++) {
|
|
|
|
|
fprintf(fp,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %s\n",a[i].name);
|
|
|
|
|
fprintf(fp,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n",a[i].number);
|
|
|
|
|
fprintf(fp,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %s\n",a[i].vender);
|
|
|
|
|
fprintf(fp,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %s\n",a[i].filed);
|
|
|
|
|
fprintf(fp,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n",a[i].stock);
|
|
|
|
|
fprintf(fp,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %.2lf\n\n\n",a[i].unvalent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("\n\n\n\n\n\n <20><>Ʒ<EFBFBD><C6B7>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!!!\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
void savedd() {
|
|
|
|
|
FILE *fp;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
fp = fopen("ddxx.txt","w");
|
|
|
|
|
assert(fp != NULL);
|
|
|
|
|
|
|
|
|
|
fprintf(fp," <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>\n");
|
|
|
|
|
//<2F><>Ʒ<EFBFBD><C6B7>Ϣ<EFBFBD><CFA2>¼<EFBFBD><C2BC>
|
|
|
|
|
for (i = 0; i < ordern; i++) {
|
|
|
|
|
fprintf(fp,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD> :%d\n",b[i].goodnumber);
|
|
|
|
|
fprintf(fp,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> :%d\n",b[i].ordernumber);
|
|
|
|
|
fprintf(fp,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD> :%d\n",b[i].ordertime);
|
|
|
|
|
fprintf(fp,"<EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD> :%s\n",b[i].customername);
|
|
|
|
|
fprintf(fp,"<EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD>ַ :%s\n",b[i].customeraddress);
|
|
|
|
|
fprintf(fp,"<EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD> :%d\n\n\n",b[i].customernumber);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ķ<EFBFBD><C4B7><EFBFBD>
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("\n\n\n\n\n\n <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!!!\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
system("pause");
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD>ά<EFBFBD><CEAC><EFBFBD>Ӳ˵<D3B2>
|
|
|
|
|
void secondmain() {
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
system("cls");
|
|
|
|
|
printf("\n\n\n\n\n\n\n");
|
|
|
|
|
printf("********************************<2A><><EFBFBD><EFBFBD><EFBFBD>Ӳ˵<D3B2>************************************\n\n");
|
|
|
|
|
printf(" 1.<2E><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>Ʒ \n");
|
|
|
|
|
printf(" 2.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ \n");
|
|
|
|
|
printf(" 3.ɾ<><C9BE><EFBFBD><EFBFBD>Ʒ \n");
|
|
|
|
|
printf(" 4.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ \n");
|
|
|
|
|
printf(" 5.<2E><><EFBFBD>涩<EFBFBD><E6B6A9> \n");
|
|
|
|
|
printf(" 0.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> \n");
|
|
|
|
|
printf("**************************************************************************\n\n\n\n\n");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printf("\n\n <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫѡ<D2AA><D1A1><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD>(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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F>Ӽ<EFBFBD><D3BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
|
|
|
|
|
void shuru() {
|
|
|
|
|
char ch;
|
|
|
|
|
int n = 1;
|
|
|
|
|
goodsn = 0;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
switch(n) {
|
|
|
|
|
case 1:
|
|
|
|
|
//<2F><>Ʒ<EFBFBD><C6B7>¼<EFBFBD><C2BC>
|
|
|
|
|
system("cls");
|
|
|
|
|
printf(" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>Ϣ\n");
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d<><64><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>Ϣ:\n",goodsn + 1);
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
gets(a[goodsn].name);
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%d",&a[goodsn].number);
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
gets(a[goodsn].vender);
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
gets(a[goodsn].filed);
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%d",&a[goodsn].stock);
|
|
|
|
|
printf("\n <20><><EFBFBD><EFBFBD>:");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%lf",&a[goodsn].unvalent);
|
|
|
|
|
|
|
|
|
|
goodsn++;
|
|
|
|
|
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
case 2:
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼?(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("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼?(Y/N)");
|
|
|
|
|
fflush(stdin);
|
|
|
|
|
scanf("%c",&ch);
|
|
|
|
|
n = 2;
|
|
|
|
|
}
|
|
|
|
|
} while(ch != 'n' && ch != 'N');
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>Ϣ
|
|
|
|
|
void daoru() {
|
|
|
|
|
FILE *fp;
|
|
|
|
|
char ch[30];
|
|
|
|
|
double dou;
|
|
|
|
|
int in;
|
|
|
|
|
int i = 0;
|
|
|
|
|
goodsn = 0;
|
|
|
|
|
|
|
|
|
|
fp = fopen("spxx.txt","r");
|
|
|
|
|
assert(fp);
|
|
|
|
|
|
|
|
|
|
//<2F><><EFBFBD>ļ<EFBFBD><C4BC>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>Ϣ
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ
|
|
|
|
|
void search() {
|
|
|
|
|
int i;
|
|
|
|
|
int j;
|
|
|
|
|
char ch;
|
|
|
|
|
int n = 1;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
switch(n) {
|
|
|
|
|
case 1:
|
|
|
|
|
system("cls");
|
|
|
|
|
printf(" <20><>Ʒ<EFBFBD>б<EFBFBD>\n");
|
|
|
|
|
//<2F><>ʾ<EFBFBD><CABE>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>ơ<EFBFBD><C6A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>²<EFBFBD><C2B2><EFBFBD>ɾ<EFBFBD><C9BE>
|
|
|
|
|
for (i = 0; i < goodsn; i++) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %s\n",a[i].name);
|
|
|
|
|
printf("ID : %d\n",i);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %d\n\n\n",a[i].stock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<2F><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
printf("\n\n\n <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>ID:");
|
|
|
|
|
scanf("%d",&j);
|
|
|
|
|
|
|
|
|
|
if(0<=j&&j<=goodsn) {
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %s\n",a[j].name);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %d\n",a[j].number);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %s\n",a[j].vender);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %s\n",a[j].filed);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %d\n",a[j].stock);
|
|
|
|
|
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD> : %.2lf\n\n\n",a[j].unvalent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
printf("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ?(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("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD>!\n");
|
|
|
|
|
printf(" ");
|
|
|
|
|
system("pause");
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|