|
|
|
@ -0,0 +1,90 @@
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
struct dic_info
|
|
|
|
|
{
|
|
|
|
|
char English[40];
|
|
|
|
|
char Chinese[100];
|
|
|
|
|
};
|
|
|
|
|
struct dic_info inf[400];
|
|
|
|
|
void enter()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
void add()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
void Delete()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
void Edit()
|
|
|
|
|
{
|
|
|
|
|
int a;
|
|
|
|
|
int i;
|
|
|
|
|
char n[40];
|
|
|
|
|
printf("请输入要修改的单词:");
|
|
|
|
|
while(1)
|
|
|
|
|
{
|
|
|
|
|
scanf("%s",n);
|
|
|
|
|
for(i=0;i<400;i++)
|
|
|
|
|
{
|
|
|
|
|
if(strcmp(n,inf[i].English)==0)
|
|
|
|
|
{
|
|
|
|
|
printf("请输入要修改的内容:\n");
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
printf("1.修改单词\n");
|
|
|
|
|
printf("2.修改释义\n");
|
|
|
|
|
printf("0.放弃修改\n");
|
|
|
|
|
scanf("%d",&a) ;
|
|
|
|
|
switch(a)
|
|
|
|
|
{
|
|
|
|
|
case 1:printf("请输入修改后的单词:");scanf("%s",&inf[i].English);break;
|
|
|
|
|
case 2:printf("请输入修改后的释义:");scanf("%s",&inf[i].Chinese);break;
|
|
|
|
|
}
|
|
|
|
|
}while(a!=0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("无此单词\n") ;
|
|
|
|
|
printf("输入y或Y继续操作,输入其他返回菜单\n");
|
|
|
|
|
scanf("%c",&a);
|
|
|
|
|
if(a=='y'||a=='Y')
|
|
|
|
|
{
|
|
|
|
|
Edit();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
int main(void)
|
|
|
|
|
{
|
|
|
|
|
int choice,i,n=1;
|
|
|
|
|
char a,b;
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
printf("\n\t ==============================");
|
|
|
|
|
printf("\n\t *欢迎使用有限电子英汉词典*");
|
|
|
|
|
printf("\n\t ==============================\n");
|
|
|
|
|
printf("\n\t ***********菜单显示***********\n");
|
|
|
|
|
printf("\n\t ********【1】词条查找********\n");
|
|
|
|
|
printf("\n\t ********【2】词条增词********\n");
|
|
|
|
|
printf("\n\t ********【3】词条删除********\n");
|
|
|
|
|
printf("\n\t ********【4】词条修改********\n");
|
|
|
|
|
printf("\n\t ********【0】退出词典********\n");
|
|
|
|
|
printf("请选择你要进行的功能");
|
|
|
|
|
scanf("%d",&choice);
|
|
|
|
|
switch(choice)
|
|
|
|
|
{
|
|
|
|
|
case 1:enter();break;
|
|
|
|
|
case 2:add();break;
|
|
|
|
|
case 3:Delete();break;
|
|
|
|
|
case 4:Edit();
|
|
|
|
|
scanf("%c",&a);
|
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
|
if(a=='y'||a=='Y')
|
|
|
|
|
{
|
|
|
|
|
Edit();
|
|
|
|
|
n++;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while(choice!=0);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|