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.

305 lines
6.1 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];
6 years ago
char liju[100];
6 years ago
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);
6 years ago
printf("%s %s %s %s ",temp.english,temp.chinese,temp.liju,temp.shuxing);
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>");
printf("<EFBFBD>˸񣺲鿴<EFBFBD>ղؼ<EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>\n");
6 years ago
while(1)
{
int n=0;
printf("\n\n\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ո<EFBFBD><EFBFBD><EFBFBD> ");
6 years ago
if(i==0)
printf("<EFBFBD>˸񣺲鿴<EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>");
else
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.liju,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>:%s Ӣ<><D3A2><EFBFBD><EFBFBD>:%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:%s\n",temp.chinese,temp.english,temp.liju,temp.shuxing);
6 years ago
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> ");
6 years ago
if(i==0)
printf("<EFBFBD>˸񣺲鿴<EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD>");
else
6 years ago
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)
{
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.liju,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>");
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));
6 years ago
// printf("%s %s %s %s ",temp.english,temp.chinese,temp.liju,temp.shuxing);
6 years ago
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.shuxing);
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>");
fflush(stdin);
gets(temp.liju);
printf("%s %s %s %s ",temp.english,temp.chinese,temp.liju,temp.shuxing);
6 years ago
// 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
{
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.liju,temp.shuxing);
6 years ago
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>ԣ<EFBFBD>");
scanf("%s",temp.shuxing);
6 years ago
printf("<EFBFBD><EFBFBD><EFBFBD>");
fflush(stdin);
gets(temp.liju);
6 years ago
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();
}