diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..08a1e42 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,28 @@ +{ + // 使用 IntelliSense 了解相关属性。 + // 悬停以查看现有属性的描述。 + // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) Launch", + "type": "cppdbg", + "request": "launch", + "program": "enter program name, for example ${workspaceFolder}/a.exe", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": true, + "MIMode": "gdb", + "miDebuggerPath": "/path/to/gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/a.txt b/a.txt index 2afc4e9..a2b6d5f 100644 --- a/a.txt +++ b/a.txt @@ -1 +1,5 @@ -1 1 1 1 0 +1 1 1 1 0 +2 2 2 2 0 +1 1 1 1 111 +2 2 2 222 +1 1 1 1 111 diff --git a/ddxx.txt b/ddxx.txt new file mode 100644 index 0000000..470169e --- /dev/null +++ b/ddxx.txt @@ -0,0 +1,9 @@ + б + :1 + :1 +ʱ :2099 +ͻ :CIERRA +ͻַ :JAPAN +ͻ :19 + + diff --git a/main.c b/main.c index b477fac..4791c22 100644 --- a/main.c +++ b/main.c @@ -1,293 +1,625 @@ -#include -#include /*˵*/ -#include /*ַ*/ -#include -#define max 100 -#define LEN 15 -#define N 50 -int k = 1, n = 0, m = 0; - -typedef struct Bank { - char no[13];// - char name[10];// - char sex[8];//Ա - int balance;// - char passwd[20]; -} bank, ban[max]; -void fileWrite(int n, ban s); -void modify() { - int j = 0; - FILE * fp; - if ((fp = fopen("a.txt", "r")) == NULL) return; - 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) { - j++; +#include +#include +#include +#include +#include + + + +int bgnumber = 023; //ͻ +int goodsn = 0; //Ʒͳ +int ordern = 0; //ͳ + + +void secondmain(); //άӲ˵ +void shuru(); //Ʒ +void browse(); //Ʒ +void search(); //Ʒ +void order(); //Ʒ +void seek(); //ѯ +void add(); //Ʒ +void del(); //ɾƷ +void savesp(); //Ʒ +void savedd(); //涩 +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; - int i, item, num; - int age; - char sex1[8], s1[LEN + 1], s2[LEN + 1],passwd1[20],age1[10]; - float score1; - printf("Ҫ޸ĵûĿ:\n"); - scanf("%s", s1); - for (i = 0; i= 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; - case 2: - printf("µԱ:\n"); - scanf("%s", &sex1); - strcpy(s[num].sex, sex1); - fileWrite(n, s); + } else if(ch == 'Y' || ch == 'y') { + c = 0; + n = 1; break; - case 3: - printf("µ:\n"); - scanf("%s", &passwd1); - strcpy(s[num].passwd, passwd1); - fileWrite(n, s); + } else if(ch != 'n' || ch != 'N' || ch != 'Y' || ch != 'y') { + n = 0; + c = 1; break; - case 4: - return; - default: - printf("1-4֮ѡ\n"); } - } - } - else { - printf("ûиÿ!!!\n"); + + case 0: + if(c == 1) { + n = 2; + } } - } - system("pause"); + + } while(ch != 'n' && ch != 'N'); + system("cls"); + + return ; } -void insert() { - int i, a, b; - printf("ӵû:\n"); - scanf("%d", &n); - FILE * fp; - if ((fp = fopen("a.txt", "at")) == NULL) return; - ban s; - for (i = 0; i