You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

302 lines
6.1 KiB

6 years ago
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include<conio.h>
6 years ago
#include <windows.h>
6 years ago
#define FILENAME "<22><><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>31.txt"
#define shoucanjia "<22>ղؼ<D5B2>56.txt"
struct word
{
char chinese[100];
char english[100];
6 years ago
char mean[100];
6 years ago
char shuxing[100];
};
6 years ago
void color(short x) //<2F>Զ<EFBFBD><D4B6><EFBFBD><E5BAAF><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>ɫ
{
if(x>=0 && x<=15)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0-15<31>ķ<EFBFBD>Χ<EFBFBD><CEA7>ɫ
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), x); //ֻ<><D6BB>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
else//Ĭ<>ϵ<EFBFBD><CFB5><EFBFBD>ɫ<EFBFBD><C9AB>ɫ
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
}
6 years ago
FILE *FP;
FILE *fileopen(char FileName[])//<2F>򿪷<EFBFBD><F2BFAAB7><EFBFBD><EFBFBD>ĵ<EFBFBD>
{
FILE *fp;
if((fp=fopen(FileName,"rb"))==NULL)
{
6 years ago
color(4); printf("NO");
6 years ago
}
fp=fopen(FileName,"ab+");
}
void fileclose(FILE *fp)//<2F>رշ<D8B1><D5B7><EFBFBD><EFBFBD>ĵ<EFBFBD>
{
if(fclose(fp)!=NULL)
{
6 years ago
color(4); printf("close defit");
6 years ago
}
}
void shoucan(word temp)//<2F>ղصĵ<D8B5><C4B5><EFBFBD>
{
FP=fileopen(shoucanjia);
6 years ago
printf("\n%s %s %s %s ",temp.english,temp.chinese,temp.mean,temp.shuxing);
printf("<EFBFBD>ղسɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
6 years ago
fwrite(&temp,sizeof(temp),1,FP);
fileclose(FP);
}
void findlike()//<2F><><EFBFBD>ղؼ<D5B2>
{
system("cls");
FILE *fp;
if((fp=fopen(shoucanjia,"r"))==NULL)
{
printf("OPEN DEFIT");
}
char tempenglish[100];
for(int z=0;z<=100;z++)
tempenglish[z]=0;
char *res;
word temp;
int n=0,i=0;
printf("PLEAES INPUT ENGLISH:");
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>");
printf("<EFBFBD>˸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>\n");
6 years ago
while(1)
{
6 years ago
int m=0;
6 years ago
printf("\n\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ո<EFBFBD><EFBFBD><EFBFBD> ");
6 years ago
if(i!=0)
6 years ago
printf("<EFBFBD>˸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
char c=getch();
system("cls");
if(c==32)
break;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>");
if(c==8)
{
tempenglish[i-1]=0;
for(int j=0;j<i;j++)
{
printf("%c",tempenglish[j]);
}
i=i-1;
}
else{
tempenglish[i]=c;
for(int j=0;j<=i;j++)
printf("%c",tempenglish[j]);
i=i+1;
}
FILE *fp;
if((fp=fopen(shoucanjia,"r"))==NULL)
{
printf("OPEN DEFIT");
}
while(fread(&temp,sizeof(word),1,fp))
{
if(strcmp(temp.english,tempenglish)==0)
{
6 years ago
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s Ӣ<><D3A2><EFBFBD><EFBFBD>:%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s\n",temp.chinese,temp.english,temp.mean,temp.shuxing);
6 years ago
n=0;
}
else
{
char *res = strstr(temp.english,tempenglish);
if(res == NULL)
{
n=2;
}
else
{
6 years ago
printf("\n<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵĿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s Ӣ<><D3A2><EFBFBD><EFBFBD>:%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s\n",temp.chinese,temp.english,temp.mean,temp.shuxing);
m=1;
6 years ago
}
}
}
fileclose(fp);
6 years ago
if(n==2&&m==0)
6 years ago
printf("\nno this");
}
fileclose(fp);
}
void change()//<2F><><EFBFBD><EFBFBD>
{
system("cls");
char tempenglish[100];
for(int z=0;z<=100;z++)
tempenglish[z]=0;
char *res;
word temp;
6 years ago
int n=0,i=0,m=0;
6 years ago
printf(" <20><><EFBFBD><EFBFBD>ʣ<EFBFBD>");
6 years ago
printf("<EFBFBD>˸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD>ʡ<EFBFBD>");
6 years ago
while(1)
{
6 years ago
m=0;
6 years ago
printf("\n\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ո<EFBFBD><EFBFBD><EFBFBD> ");
6 years ago
if(i!=0)
6 years ago
printf("<EFBFBD>˸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
char c=getch();
stop: system("cls");
if(c==32)
break;
printf(" <20><><EFBFBD><EFBFBD>ʣ<EFBFBD>");
if(c==8)
{
tempenglish[i-1]=0;
for(int j=0;j<i;j++)
{
printf("%c",tempenglish[j]);
}
i=i-1;
}
else{
tempenglish[i]=c;
for(int j=0;j<=i;j++)
printf("%c",tempenglish[j]);
i=i+1;
}
FILE *fp;
6 years ago
if((fp=fopen(FILENAME,"rb+"))==NULL)
{
printf("OPEN DEFIT");
}
6 years ago
while(fread(&temp,sizeof(word),1,fp))
6 years ago
{
6 years ago
if(strcmp(temp.english,tempenglish)==0)
{
6 years ago
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s Ӣ<><D3A2><EFBFBD><EFBFBD>:%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s\n",temp.chinese,temp.english,temp.mean,temp.shuxing);
6 years ago
printf("\n-------<2D><>1<EFBFBD>ղ<EFBFBD>");
printf("\n-------<2D><>0<EFBFBD>޸<EFBFBD>");
printf("\n-------<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
c=getch();
if(c==49)
{
shoucan(temp);//<2F>ղص<D5B2><D8B5><EFBFBD>
}
else if(c==48)//<2F>޸ĵ<DEB8><C4B5><EFBFBD>
{
printf("\n<EFBFBD>޸ĺ<EFBFBD><EFBFBD><EFBFBD>Ӣ<EFBFBD><EFBFBD>:");
scanf("%s",temp.english);
printf("<EFBFBD>޸ĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˼:");
scanf("%s",temp.chinese);
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>");
6 years ago
fflush(stdin);
gets(temp.mean);
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>");
scanf("%s",temp.shuxing);
6 years ago
printf("%s %s %s %s ",temp.english,temp.chinese,temp.mean,temp.shuxing);
6 years ago
fseek(fp,-sizeof(word),SEEK_CUR);
fwrite(&temp,sizeof(temp),1,fp);
printf("<EFBFBD>޸ijɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
//fileclose(fp);
break;
}
else
goto stop;
6 years ago
6 years ago
}
6 years ago
else
6 years ago
{
6 years ago
char *res = strstr(temp.english,tempenglish);
if(res != NULL)
{
printf("\n<EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD>ҵĿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD>\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s Ӣ<><D3A2><EFBFBD><EFBFBD>:%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s\n",temp.chinese,temp.english,temp.mean,temp.shuxing);
m=1;
}
else
{
n=2;
}
6 years ago
}
}
fileclose(fp);
6 years ago
if(n==2&&m==0)
6 years ago
{
6 years ago
printf("\nû<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
}
6 years ago
}
}
void putinto()//<2F><><EFBFBD><EFBFBD><EFBFBD>ʿ<EFBFBD>
{
6 years ago
color(2);
6 years ago
stop: printf("\n");
FP=fileopen(FILENAME);
word temp;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD>ʣ<EFBFBD>");
scanf("%s",temp.english);
printf("<EFBFBD>˵<EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>");
scanf("%s",temp.chinese);
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD>");
6 years ago
fflush(stdin);
gets(temp.mean);
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>");
scanf("%s",temp.shuxing);
fwrite(&temp,sizeof(temp),1,FP);
printf("<EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
fileclose(FP);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Y/<2F>˳<EFBFBD>N");
char b=getch();
6 years ago
if(b==89||b==121)
6 years ago
goto stop;
}
int caidan()//<2F>˵<EFBFBD>
{
int choose=1;
6 years ago
6 years ago
while(choose!=0)
{
6 years ago
color(1);
6 years ago
printf("\n");
printf(" *********************************************************\n");
printf(" # #\n");
printf(" # <20><>ѡ<EFBFBD><D1A1>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1> #\n");
printf(" # #\n");
printf(" *********************************************************\n");
printf(" # #\n");
printf(" # 0.<2E>˳<EFBFBD> 1.<2E><><EFBFBD><EFBFBD><EBB5A5> #\n");
printf(" # #\n");
printf(" # 2.<2E><><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD> 3.<2E><><EFBFBD><EFBFBD> #\n");
6 years ago
printf(" # 4.<2E><EFBFBD>ղؼ<D5B2> #\n");
6 years ago
printf(" *********************************************************\n");
printf("\n");
6 years ago
scanf("%d",&choose);
6 years ago
switch(choose)
{
case 0:return 0;break;
case 1:putinto();break;
case 2:change();break;
case 3:system("cls");break;
case 4:findlike();break;
}
}
}
int main()//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
caidan();
}