|
|
@ -2,6 +2,7 @@
|
|
|
|
#include "stdlib.h"
|
|
|
|
#include "stdlib.h"
|
|
|
|
#include "string.h"
|
|
|
|
#include "string.h"
|
|
|
|
#include<conio.h>
|
|
|
|
#include<conio.h>
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#define FILENAME "翻译文档31.txt"
|
|
|
|
#define FILENAME "翻译文档31.txt"
|
|
|
|
#define shoucanjia "收藏夹56.txt"
|
|
|
|
#define shoucanjia "收藏夹56.txt"
|
|
|
|
struct word
|
|
|
|
struct word
|
|
|
@ -12,6 +13,19 @@ struct word
|
|
|
|
char shuxing[100];
|
|
|
|
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;
|
|
|
|
FILE *FP;
|
|
|
@ -20,7 +34,7 @@ FILE *fileopen(char FileName[])//
|
|
|
|
FILE *fp;
|
|
|
|
FILE *fp;
|
|
|
|
if((fp=fopen(FileName,"rb"))==NULL)
|
|
|
|
if((fp=fopen(FileName,"rb"))==NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("NO");
|
|
|
|
color(4); printf("NO");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fp=fopen(FileName,"ab+");
|
|
|
|
fp=fopen(FileName,"ab+");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -29,7 +43,7 @@ void fileclose(FILE *fp)//
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(fclose(fp)!=NULL)
|
|
|
|
if(fclose(fp)!=NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("close defit");
|
|
|
|
color(4); printf("close defit");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -141,11 +155,6 @@ void change()//
|
|
|
|
printf("退格:退后一个单词");
|
|
|
|
printf("退格:退后一个单词");
|
|
|
|
char c=getch();
|
|
|
|
char c=getch();
|
|
|
|
stop: system("cls");
|
|
|
|
stop: system("cls");
|
|
|
|
// if(c==49)
|
|
|
|
|
|
|
|
// {
|
|
|
|
|
|
|
|
// shoucan(temp);//收藏单词;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
if(c==32)
|
|
|
|
if(c==32)
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
printf(" 输入单词:");
|
|
|
|
printf(" 输入单词:");
|
|
|
@ -165,10 +174,10 @@ void change()//
|
|
|
|
i=i+1;
|
|
|
|
i=i+1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FILE *fp;
|
|
|
|
FILE *fp;
|
|
|
|
if((fp=fopen(FILENAME,"rb+"))==NULL)
|
|
|
|
if((fp=fopen(FILENAME,"rb+"))==NULL)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("OPEN DEFIT");
|
|
|
|
printf("OPEN DEFIT");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
while(fread(&temp,sizeof(word),1,fp))
|
|
|
|
while(fread(&temp,sizeof(word),1,fp))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -185,19 +194,16 @@ void change()//
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(c==48)//修改单词
|
|
|
|
else if(c==48)//修改单词
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// printf("%d",sizeof(word));
|
|
|
|
|
|
|
|
// printf("%s %s %s %s ",temp.english,temp.chinese,temp.mean,temp.shuxing);
|
|
|
|
|
|
|
|
printf("\n修改后的英文:");
|
|
|
|
printf("\n修改后的英文:");
|
|
|
|
scanf("%s",temp.english);
|
|
|
|
scanf("%s",temp.english);
|
|
|
|
printf("修改后的意思:");
|
|
|
|
printf("修改后的意思:");
|
|
|
|
scanf("%s",temp.chinese);
|
|
|
|
scanf("%s",temp.chinese);
|
|
|
|
printf("例子:");
|
|
|
|
printf("例子:");
|
|
|
|
scanf("%s",temp.mean);
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
gets(temp.mean);
|
|
|
|
printf("属性:");
|
|
|
|
printf("属性:");
|
|
|
|
scanf("%s",temp.shuxing);
|
|
|
|
scanf("%s",temp.shuxing);
|
|
|
|
printf("%s %s %s %s ",temp.english,temp.chinese,temp.mean,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);
|
|
|
|
fseek(fp,-sizeof(word),SEEK_CUR);
|
|
|
|
|
|
|
|
|
|
|
|
fwrite(&temp,sizeof(temp),1,fp);
|
|
|
|
fwrite(&temp,sizeof(temp),1,fp);
|
|
|
@ -210,32 +216,31 @@ void change()//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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
|
|
|
|
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);
|
|
|
|
fileclose(fp);
|
|
|
|
if(n==2&&m==0)
|
|
|
|
if(n==2&&m==0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
printf("\nno this");
|
|
|
|
printf("\n没有这个单词");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void putinto()//插入词库
|
|
|
|
void putinto()//插入词库
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
color(2);
|
|
|
|
stop: printf("\n");
|
|
|
|
stop: printf("\n");
|
|
|
|
FP=fileopen(FILENAME);
|
|
|
|
FP=fileopen(FILENAME);
|
|
|
|
word temp;
|
|
|
|
word temp;
|
|
|
@ -244,7 +249,8 @@ stop: printf("\n");
|
|
|
|
printf("此单词的中文:");
|
|
|
|
printf("此单词的中文:");
|
|
|
|
scanf("%s",temp.chinese);
|
|
|
|
scanf("%s",temp.chinese);
|
|
|
|
printf("例句:");
|
|
|
|
printf("例句:");
|
|
|
|
scanf("%s",temp.mean);
|
|
|
|
fflush(stdin);
|
|
|
|
|
|
|
|
gets(temp.mean);
|
|
|
|
printf("属性:");
|
|
|
|
printf("属性:");
|
|
|
|
scanf("%s",temp.shuxing);
|
|
|
|
scanf("%s",temp.shuxing);
|
|
|
|
fwrite(&temp,sizeof(temp),1,FP);
|
|
|
|
fwrite(&temp,sizeof(temp),1,FP);
|
|
|
@ -252,7 +258,7 @@ stop: printf("\n");
|
|
|
|
fileclose(FP);
|
|
|
|
fileclose(FP);
|
|
|
|
printf("继续输入Y/退出N");
|
|
|
|
printf("继续输入Y/退出N");
|
|
|
|
char b=getch();
|
|
|
|
char b=getch();
|
|
|
|
if(b==89)
|
|
|
|
if(b==89||b==121)
|
|
|
|
goto stop;
|
|
|
|
goto stop;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -260,8 +266,10 @@ stop: printf("\n");
|
|
|
|
int caidan()//菜单
|
|
|
|
int caidan()//菜单
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int choose=1;
|
|
|
|
int choose=1;
|
|
|
|
|
|
|
|
|
|
|
|
while(choose!=0)
|
|
|
|
while(choose!=0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
color(1);
|
|
|
|
printf("\n");
|
|
|
|
printf("\n");
|
|
|
|
printf(" *********************************************************\n");
|
|
|
|
printf(" *********************************************************\n");
|
|
|
|
printf(" # #\n");
|
|
|
|
printf(" # #\n");
|
|
|
@ -272,7 +280,7 @@ int caidan()//
|
|
|
|
printf(" # 0.退出 1.输入单词 #\n");
|
|
|
|
printf(" # 0.退出 1.输入单词 #\n");
|
|
|
|
printf(" # #\n");
|
|
|
|
printf(" # #\n");
|
|
|
|
printf(" # 2.查找单词 3.清屏 #\n");
|
|
|
|
printf(" # 2.查找单词 3.清屏 #\n");
|
|
|
|
printf(" # 4.查看收藏夹 #\n");
|
|
|
|
printf(" # 4.查看收藏夹 #\n");
|
|
|
|
printf(" *********************************************************\n");
|
|
|
|
printf(" *********************************************************\n");
|
|
|
|
printf("\n");
|
|
|
|
printf("\n");
|
|
|
|
scanf("%d",&choose);
|
|
|
|
scanf("%d",&choose);
|
|
|
|