diff --git a/究极翻译.cpp b/究极翻译.cpp index 5608bc9..4e12bcc 100644 --- a/究极翻译.cpp +++ b/究极翻译.cpp @@ -2,6 +2,7 @@ #include "stdlib.h" #include "string.h" #include +#include #define FILENAME "ĵ31.txt" #define shoucanjia "ղؼ56.txt" struct word @@ -12,6 +13,19 @@ struct word char shuxing[100]; }; +void color(short x) //Զ庯ݲıɫ + +{ + + if(x>=0 && x<=15)//0-15ķΧɫ + + SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), x); //ֻһıɫ + + else//Ĭϵɫɫ + + SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7); + +} FILE *FP; @@ -20,7 +34,7 @@ FILE *fileopen(char FileName[])// FILE *fp; if((fp=fopen(FileName,"rb"))==NULL) { - printf("NO"); + color(4); printf("NO"); } fp=fopen(FileName,"ab+"); } @@ -29,7 +43,7 @@ void fileclose(FILE *fp)// { if(fclose(fp)!=NULL) { - printf("close defit"); + color(4); printf("close defit"); } } @@ -141,11 +155,6 @@ void change()// printf("˸˺һ"); char c=getch(); stop: system("cls"); - // if(c==49) - // { - // shoucan(temp);//ղصʣ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - // break; - // } if(c==32) break; printf(" 뵥ʣ"); @@ -165,11 +174,11 @@ void change()// i=i+1; } FILE *fp; - if((fp=fopen(FILENAME,"rb+"))==NULL) - { - printf("OPEN DEFIT"); - } - + if((fp=fopen(FILENAME,"rb+"))==NULL) + { + printf("OPEN DEFIT"); + } + while(fread(&temp,sizeof(word),1,fp)) { if(strcmp(temp.english,tempenglish)==0) @@ -185,19 +194,16 @@ void change()// } else if(c==48)//޸ĵ { - // printf("%d",sizeof(word)); - // printf("%s %s %s %s ",temp.english,temp.chinese,temp.mean,temp.shuxing); printf("\n޸ĺӢ:"); scanf("%s",temp.english); printf("޸ĺ˼:"); scanf("%s",temp.chinese); printf("ӣ"); - scanf("%s",temp.mean); + fflush(stdin); + gets(temp.mean); printf("ԣ"); scanf("%s",temp.shuxing); printf("%s %s %s %s ",temp.english,temp.chinese,temp.mean,temp.shuxing); - // printf("%d",sizeof(word)); - // printf("%d",sizeof(temp)); fseek(fp,-sizeof(word),SEEK_CUR); fwrite(&temp,sizeof(temp),1,fp); @@ -210,32 +216,31 @@ void change()// } - else - { - char *res = strstr(temp.english,tempenglish); - if(res != NULL) + else { - printf("\nҪҵĿǣ\n:%s Ӣ:%s :%s :%s\n",temp.chinese,temp.english,temp.mean,temp.shuxing); - m=1; - } - else - { - n=2; + char *res = strstr(temp.english,tempenglish); + if(res != NULL) + { + printf("\nҪҵĿǣ\n:%s Ӣ:%s :%s :%s\n",temp.chinese,temp.english,temp.mean,temp.shuxing); + m=1; + } + else + { + n=2; + } } } - } fileclose(fp); if(n==2&&m==0) { - printf("\nno this"); + printf("\nû"); + } } - -} - } void putinto()//ʿ { + color(2); stop: printf("\n"); FP=fileopen(FILENAME); word temp; @@ -244,7 +249,8 @@ stop: printf("\n"); printf("˵ʵģ"); scanf("%s",temp.chinese); printf("䣺"); - scanf("%s",temp.mean); + fflush(stdin); + gets(temp.mean); printf("ԣ"); scanf("%s",temp.shuxing); fwrite(&temp,sizeof(temp),1,FP); @@ -252,7 +258,7 @@ stop: printf("\n"); fileclose(FP); printf("Y/˳N"); char b=getch(); - if(b==89) + if(b==89||b==121) goto stop; } @@ -260,8 +266,10 @@ stop: printf("\n"); int caidan()//˵ { int choose=1; + while(choose!=0) { + color(1); printf("\n"); printf(" *********************************************************\n"); printf(" # #\n"); @@ -272,10 +280,10 @@ int caidan()// printf(" # 0.˳ 1.뵥 #\n"); printf(" # #\n"); printf(" # 2.ҵ 3. #\n"); - printf(" # 4.鿴ղؼ #\n"); + printf(" # 4.鿴ղؼ #\n"); printf(" *********************************************************\n"); printf("\n"); - scanf("%d",&choose); + scanf("%d",&choose); switch(choose) { case 0:return 0;break; diff --git a/究极翻译.exe b/究极翻译.exe index 0cf5c52..2aedb26 100644 Binary files a/究极翻译.exe and b/究极翻译.exe differ diff --git a/翻译文档31.txt b/翻译文档31.txt index c6416da..9324ff3 100644 Binary files a/翻译文档31.txt and b/翻译文档31.txt differ