diff --git a/最后代码.cpp b/最后代码.cpp new file mode 100644 index 0000000..632dceb --- /dev/null +++ b/最后代码.cpp @@ -0,0 +1,565 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define N 100 + +void menu(); +void ss(); +void tushuluru(); +void tushuchaxun(); +void zuozhemingchaxun(); +void tushuliulan(); +void shumingchaxun(); +void xinxixiugai(); +void tushuxinxixiugai(); +void tushuxinxishanchu(); +void huanyingxitong(); + +struct xinxi +{ + char name[100]; + char author[100]; + char publisher[100]; + int year,yue,ri; + int price,amount; + int kuchun; +} tushuxinxu[N] ; + +void goto_xy(int x, int y) //λλõָ +{ + HANDLE hOut; + hOut = GetStdHandle(STD_OUTPUT_HANDLE); + COORD pos = { x,y }; + SetConsoleCursorPosition(hOut, pos); +} + +void color(short x) //Զ庯ݲıɫ +{ + SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), x); //ֻһıɫ +} + +void tushuluru() +{ + int uu,j; + void ss(); + j=0; + printf("ҪͼϢ\n"); + printf("¼ͼϢʱ \n"); + printf("\t\t--\t۸\t\t\t\n"); + FILE*fp; +out: + fp=fopen("a.txt","a+"); + scanf("%s%s%d%d%d%d%d%d%s",tushuxinxu[j].name,tushuxinxu[j].author,&tushuxinxu[j].year,&tushuxinxu[j].yue,&tushuxinxu[j].ri,&tushuxinxu[j].price,&tushuxinxu[j].amount,&tushuxinxu[j].kuchun,tushuxinxu[j].publisher); + fprintf(fp,"%s\t%s\t%d-%d-%d\t%d\t%d\t%d\t%s\n",tushuxinxu[j].name,tushuxinxu[j].author,tushuxinxu[j].year,tushuxinxu[j].yue,tushuxinxu[j].ri,tushuxinxu[j].price,tushuxinxu[j].amount,tushuxinxu[j].kuchun,tushuxinxu[j].publisher); + rewind(fp); + Sleep(1200); + printf("¼ɹ\n"); + fclose(fp); + printf("ǷҪ¼Ϣ\n"); + printf("ǣ12\n"); + scanf("%d",&uu); + if(uu==1) + { + goto out; + j++; + } + else + { + system("cls"); + ss(); + } +} +void huanyingxitong() +{ + system("cls"); + printf("ллʹñϵͳ,thanks\n"); + Sleep(1200); + system("cls"); + menu(); +} + +void ss()//ͼϵͳ +{ + int x,y; + system("cls"); + printf("\t\t\tͼ\t \t \t Ϣ\t \t \t ϵ\t ͳ\n"); + printf("\n \t\t\t\t밴 1-5ѡʵֹ\n\n"); + printf(" \t\t\t1.ͼϢ¼\n\n"); + printf(" \t\t\t2.ͼϢ\n\n"); + printf(" \t\t\t3.ѯͼѯ\n\n"); + printf(" \t\t\t4.ͼ鵥۵޸ͼϢɾ\n\n"); + printf(" \t\t\t5.˳ϵͳANDӭ\n\n"); + printf("ҪѡIJ˵\n"); + printf("\n"); + printf("ѡǣ"); + while(1) + { + scanf("%d",&x); + fflush(stdin); + if(x>5||x<1) + { + printf(":"); + continue; + } + break; + } //ͼϵͳв + if(x==1) + { + system("cls"); + tushuluru(); + } + if(x==2) + { + printf("Ե......\n"); + Sleep(500); + printf("ϲѯɹ\n"); + Sleep(1200); + system("cls"); + tushuliulan(); + } + if(x==3) + { + printf("Ե......\n"); + Sleep(500); + printf("ϲɹ\n"); + Sleep(1200); + system("cls"); + tushuchaxun(); + } + if(x==4) + { + printf("Ե......\n"); + Sleep(500); + printf("ϲɹ\n"); + Sleep(1200); + system("cls"); + xinxixiugai(); + }if(x==5) + { + huanyingxitong(); + } +} +void xinxixiugai() +{ + int i; + printf("1:ͼ鵥۵޸\n"); + printf("2:ͼϢɾ\n"); + printf(":"); + ww:scanf("%d",&i); + fflush(stdin); + if(i==1) + { + tushuxinxixiugai(); + system("cls"); + } + else if(i==2) + { + tushuxinxishanchu(); + system("cls"); + }if(i!=1||i!=2) + { + printf("\n"); + goto ww; + } +} +void tushuxinxixiugai() +{ + int j,h,q,w,e,z,i; + xx:FILE*fp; + FILE*CC; + e=0; + z=0; + j=0; + fp=fopen("a.txt","r+"); + while(!feof(fp)) + { + fscanf(fp,"%s%s%d%d%d%d%d%d%s",tushuxinxu[j].name,tushuxinxu[j].author,&tushuxinxu[j].year,&tushuxinxu[j].yue,&tushuxinxu[j].ri,&tushuxinxu[j].price,&tushuxinxu[j].amount,&tushuxinxu[j].kuchun,tushuxinxu[j].publisher); + j++; + } + rewind(fp); + fclose(fp); + CC=fopen("a.txt","w+"); + printf("ĵ:"); + scanf("%d",&q); + for(h=0;h0) + p--; + } + if(!isdigit(ch)&&!isalpha(ch)) + continue; + putchar('*'); + pwd[p++]=ch; + } + pwd[p]=0; + if(strcmp(c,pwd)==0) + { + system("color 0"); + printf("\nȷ\n"); + p=0; + system("cls"); + ss(); + } + else + { + system("color 2"); + system("cls"); + printf("******!*******\n"); + system("pause"); + } + } +} + +void tushuliulan() +{ + int i; + char ch; + printf("ǰ㽫¼ͼϢ\n"); + printf("\t\t--\t۸\t\t\t\n"); + FILE*fp=fopen("a.txt","r"); + while(!feof(fp)) + { + ch=fgetc(fp); + printf("%c",ch); + } + printf("\n"); + printf("\n"); + printf("\n"); + printf("************************************\n"); + printf("Ƿ뷵һ\n"); + printf("1:룺1\n"); + printf("2:㲻벻Ҫ\n"); + printf(":"); +ii: + scanf("%d",&i); + fflush(stdin); + if(i==1) + { + system("cls"); + ss(); + } + else + { + printf("\n"); + goto ii; + } +} +void shumingchaxun() +{ + int h,j,z,count; + j=0; + h=0; + + char an[100]; + FILE*fp; + fp=fopen("a.txt","r"); + while(fscanf(fp,"%s%s%d%d%d%d%d%d%s",tushuxinxu[j].name,tushuxinxu[j].author,&tushuxinxu[j].year,&tushuxinxu[j].yue,&tushuxinxu[j].ri,&tushuxinxu[j].price,&tushuxinxu[j].amount,&tushuxinxu[j].kuchun,tushuxinxu[j].publisher)!=EOF) + { + j++; + } + printf(":\n"); +xx: + count=0; + scanf("%s",an); + system("cls"); + printf("\t\t--\t۸\t\t\t\n"); + for(h=0; h