first commit

master
Your Name 6 years ago
parent 6092b096a2
commit 271a0a7c82

@ -8,7 +8,7 @@ struct word
{ {
char chinese[100]; char chinese[100];
char english[100]; char english[100];
char liju[100]; char mean[100];
char shuxing[100]; char shuxing[100];
}; };
@ -36,7 +36,8 @@ void fileclose(FILE *fp)//
void shoucan(word temp)//收藏的单词 void shoucan(word temp)//收藏的单词
{ {
FP=fileopen(shoucanjia); FP=fileopen(shoucanjia);
printf("%s %s %s %s ",temp.english,temp.chinese,temp.liju,temp.shuxing); printf("\n%s %s %s %s ",temp.english,temp.chinese,temp.mean,temp.shuxing);
printf("收藏成功!!!");
fwrite(&temp,sizeof(temp),1,FP); fwrite(&temp,sizeof(temp),1,FP);
fileclose(FP); fileclose(FP);
@ -57,16 +58,13 @@ void findlike()//
word temp; word temp;
int n=0,i=0; int n=0,i=0;
printf("PLEAES INPUT ENGLISH:"); printf("PLEAES INPUT ENGLISH:");
printf("输入:"); printf("输入单词:");
printf("退格:退格查看所有单词\n");
printf("退格:查看收藏夹内单词\n");
while(1) while(1)
{ {
int n=0; int m=0;
printf("\n\n\n返回上一级按空格键 "); printf("\n\n\n返回上一级按空格键 ");
if(i==0) if(i!=0)
printf("退格:查看所有单词");
else
printf("退格:退后一个单词"); printf("退格:退后一个单词");
char c=getch(); char c=getch();
system("cls"); system("cls");
@ -100,7 +98,7 @@ void findlike()//
if(strcmp(temp.english,tempenglish)==0) if(strcmp(temp.english,tempenglish)==0)
{ {
printf("\n中文是:%s 英文是:%s 例句是:%s 属性是:%s\n",temp.chinese,temp.english,temp.liju,temp.shuxing); printf("\n中文是:%s 英文是:%s 例句是:%s 属性是:%s\n",temp.chinese,temp.english,temp.mean,temp.shuxing);
n=0; n=0;
} }
else else
@ -112,13 +110,13 @@ void findlike()//
} }
else else
{ {
printf("\n中文是:%s 英文是:%s 例句是:%s 属性是:%s\n",temp.chinese,temp.english,temp.liju,temp.shuxing); printf("\n你要查找的可能是:\n中文是:%s 英文是:%s 例句是:%s 属性是:%s\n",temp.chinese,temp.english,temp.mean,temp.shuxing);
n=1; m=1;
} }
} }
} }
fileclose(fp); fileclose(fp);
if(n==2) if(n==2&&m==0)
printf("\nno this"); printf("\nno this");
} }
fileclose(fp); fileclose(fp);
@ -132,24 +130,22 @@ void change()//
tempenglish[z]=0; tempenglish[z]=0;
char *res; char *res;
word temp; word temp;
int n=0,i=0; int n=0,i=0,m=0;
printf(" 输入单词:"); printf(" 输入单词:");
// printf("退格查看所有单词。"); printf("退格查看所有单词。");
while(1) while(1)
{ {
n=1; m=0;
printf("\n\n\n返回上一级按空格键 "); printf("\n\n\n返回上一级按空格键 ");
if(i==0) if(i!=0)
printf("退格:查看所有单词");
else
printf("退格:退后一个单词"); printf("退格:退后一个单词");
char c=getch(); char c=getch();
stop: system("cls"); stop: system("cls");
if(c==49) // if(c==49)
{ // {
shoucan(temp);//收藏单词;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // shoucan(temp);//收藏单词;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
break; // break;
} // }
if(c==32) if(c==32)
break; break;
printf(" 输入单词:"); printf(" 输入单词:");
@ -175,16 +171,13 @@ void change()//
} }
while(fread(&temp,sizeof(word),1,fp)) while(fread(&temp,sizeof(word),1,fp))
{n=1; {
if(strcmp(temp.english,tempenglish)==0) if(strcmp(temp.english,tempenglish)==0)
{ {
printf("\n中文是:%s 英文是:%s 例句是:%s 属性是:%s\n",temp.chinese,temp.english,temp.liju,temp.shuxing); printf("\n中文是:%s 英文是:%s 例句是:%s 属性是:%s\n",temp.chinese,temp.english,temp.mean,temp.shuxing);
printf("\n-------按1收藏"); printf("\n-------按1收藏");
printf("\n-------按0修改"); printf("\n-------按0修改");
printf("\n-------按其他键继续查找"); printf("\n-------按其他键继续查找");
n=1;
c=getch(); c=getch();
if(c==49) if(c==49)
{ {
@ -193,17 +186,16 @@ void change()//
else if(c==48)//修改单词 else if(c==48)//修改单词
{ {
// printf("%d",sizeof(word)); // printf("%d",sizeof(word));
// printf("%s %s %s %s ",temp.english,temp.chinese,temp.liju,temp.shuxing); // 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("例子:");
scanf("%s",temp.mean);
printf("属性:"); printf("属性:");
scanf("%s",temp.shuxing); scanf("%s",temp.shuxing);
printf("例子:"); printf("%s %s %s %s ",temp.english,temp.chinese,temp.mean,temp.shuxing);
fflush(stdin);
gets(temp.liju);
printf("%s %s %s %s ",temp.english,temp.chinese,temp.liju,temp.shuxing);
// printf("%d",sizeof(word)); // printf("%d",sizeof(word));
// printf("%d",sizeof(temp)); // printf("%d",sizeof(temp));
fseek(fp,-sizeof(word),SEEK_CUR); fseek(fp,-sizeof(word),SEEK_CUR);
@ -215,27 +207,25 @@ void change()//
} }
else else
goto stop; goto stop;
n=0;
} }
else else
{ {
char *res = strstr(temp.english,tempenglish); char *res = strstr(temp.english,tempenglish);
if(res == NULL) if(res != NULL)
{ {
n=2; printf("\n你要查找的可能是:\n中文是:%s 英文是:%s 例句是:%s 属性是:%s\n",temp.chinese,temp.english,temp.mean,temp.shuxing);
m=1;
} }
else else
{ {
printf("\n中文是:%s 英文是:%s 例句是:%s 属性是:%s\n",temp.chinese,temp.english,temp.liju,temp.shuxing); n=2;
n=1;
} }
} }
} }
fileclose(fp); fileclose(fp);
if(n==2) if(n==2&&m==0)
{ {
printf("\nno this"); printf("\nno this");
} }
@ -253,11 +243,10 @@ stop: printf("\n");
scanf("%s",temp.english); scanf("%s",temp.english);
printf("此单词的中文:"); printf("此单词的中文:");
scanf("%s",temp.chinese); scanf("%s",temp.chinese);
printf("例句:");
scanf("%s",temp.mean);
printf("属性:"); printf("属性:");
scanf("%s",temp.shuxing); scanf("%s",temp.shuxing);
printf("例句:");
fflush(stdin);
gets(temp.liju);
fwrite(&temp,sizeof(temp),1,FP); fwrite(&temp,sizeof(temp),1,FP);
printf("添加成功!!!!!"); printf("添加成功!!!!!");
fileclose(FP); fileclose(FP);

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save