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.

296 lines
5.9 KiB

6 years ago
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
#include<conio.h>
#define FILENAME "<22><><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD>31.txt"
#define shoucanjia "<22>ղؼ<D5B2>56.txt"
struct word
{
char chinese[100];
char english[100];
char mean[100];
char shuxing[100];
};
FILE *FP;
FILE *fileopen(char FileName[])//<2F>򿪷<EFBFBD><F2BFAAB7><EFBFBD><EFBFBD>ĵ<EFBFBD>
{
FILE *fp;
if((fp=fopen(FileName,"rb"))==NULL)
{
printf("NO");
}
fp=fopen(FileName,"ab+");
}
void fileclose(FILE *fp)//<2F>رշ<D8B1><D5B7><EFBFBD><EFBFBD>ĵ<EFBFBD>
{
if(fclose(fp)!=NULL)
{
printf("close defit");
}
}
void shoucan(word temp)//<2F>ղصĵ<D8B5><C4B5><EFBFBD>
{
FP=fileopen(shoucanjia);
printf("%s %s %s %s ",temp.english,temp.chinese,temp.mean,temp.shuxing);
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:");
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>");
printf("<EFBFBD>˸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
while(1)
{
int n=0;
printf("\n\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ո<EFBFBD><EFBFBD><EFBFBD> ");
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)
{
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);
n=0;
}
else
{
char *res = strstr(temp.english,tempenglish);
if(res == NULL)
{
n=2;
}
else
{
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);
n=1;
}
}
}
fileclose(fp);
if(n==2)
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;
int n=0,i=0;
printf(" <20><><EFBFBD><EFBFBD>ʣ<EFBFBD>");
// printf("<22>˸<EFBFBD><CBB8><EFBFBD><E9BFB4><EFBFBD>е<EFBFBD><D0B5>ʡ<EFBFBD>");
while(1)
{
n=1;
printf("\n\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ո<EFBFBD><EFBFBD><EFBFBD> ");
printf("<EFBFBD>˸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
char c=getch();
stop: system("cls");
if(c==49)
{
shoucan(temp);//<2F>ղص<D5B2><D8B5>ʣ<EFBFBD>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
break;
}
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;
if((fp=fopen(FILENAME,"rb+"))==NULL)
{
printf("OPEN DEFIT");
}
while(fread(&temp,sizeof(word),1,fp))
{n=1;
if(strcmp(temp.english,tempenglish)==0)
{
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);
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>");
n=1;
c=getch();
if(c==49)
{
shoucan(temp);//<2F>ղص<D5B2><D8B5><EFBFBD>
}
else if(c==48)//<2F>޸ĵ<DEB8><C4B5><EFBFBD>
{
// printf("%d",sizeof(word));
// printf("%s %s %s %s ",temp.english,temp.chinese,temp.mean,temp.shuxing);
printf("\n<EFBFBD>޸ĺ<EFBFBD><EFBFBD><EFBFBD>Ӣ<EFBFBD><EFBFBD>:");
scanf("%s",temp.english);
printf("<EFBFBD>޸ĺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˼:");
scanf("%s",temp.chinese);
printf("<EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>");
scanf("%s",temp.mean);
printf("<EFBFBD><EFBFBD><EFBFBD>ԣ<EFBFBD>");
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);
printf("<EFBFBD>޸ijɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
//fileclose(fp);
break;
}
else
goto stop;
n=0;
}
else
{
char *res = strstr(temp.english,tempenglish);
if(res == NULL)
{
n=2;
}
else
{
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);
n=1;
}
}
}
fileclose(fp);
if(n==2)
{
printf("\nno this");
}
}
}
void putinto()//<2F><><EFBFBD><EFBFBD><EFBFBD>ʿ<EFBFBD>
{
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);
printf("<EFBFBD><EFBFBD><EFBFBD>");
scanf("%s",temp.mean);
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();
if(b==89)
goto stop;
}
int caidan()//<2F>˵<EFBFBD>
{
int choose=1;
while(choose!=0)
{
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");
printf(" # 4.<2E><EFBFBD>ղؼ<D5B2> #\n");
printf(" *********************************************************\n");
printf("\n");
scanf("%d",&choose);
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();
}