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.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
# define LEN sizeof(struct dic_info)
struct dic_info
{
char English [ 40 ] ;
char Chinese [ 100 ] ;
} ;
struct dic_info inf [ 400 ] ;
void enter ( )
{
}
void add ( )
{
}
void Edit ( )
{
}
void Delete ( )
{
int m ;
char a ;
char n [ 40 ] ;
printf ( " 请输入你要删除的单词: \n " ) ;
while ( 1 )
{
scanf ( " %s " , n ) ;
for ( m = 0 ; m < 400 ; m + + )
{
if ( strcmp ( n , inf [ m ] . English ) = = 0 )
{
inf [ m ] . English = = ' \0 ' ;
inf [ m ] . Chinese = = ' \0 ' ;
printf ( " 删除成功! \n " ) ;
return ;
}
}
printf ( " 无此单词 \n " ) ;
printf ( " 输入y或Y继续操作, 输入其他返回菜单 \n " ) ;
scanf ( " %c " , & a ) ;
if ( a = = ' y ' | | a = = ' Y ' )
{
Delete ( ) ;
}
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 ( ) ;
for ( i = 0 ; i < n ; i + + )
scanf ( " %c " , & a ) ;
if ( a = = ' y ' | | a = = ' Y ' )
{
Delete ( ) ;
n + + ;
} ; break ;
case 4 : Edit ( ) ; break ;
}
}
while ( choice ! = 0 ) ;
return 0 ;
}