diff --git a/1.c b/1.c deleted file mode 100644 index 4592a32..0000000 --- a/1.c +++ /dev/null @@ -1,31 +0,0 @@ -void add() -{ - int i,m=0; - char n; - char ch[2]; - FILE *fp; - if((fp=fopen("data.txt","ab+"))==NULL) - { - printf("文件不存在!\n"); - exit(0); - } - fseek(fp,0L,2); - printf("请输入单词: \n"); - scanf("%s",inf[m].word); - printf("请输入释义:\n"); - scanf("%s",inf[m].mean); - if(fwrite(&inf[m],LEN,1,fp)!=1) - { - printf("不能保存"); - getchar(); - } - else - { - printf("已保存\n是否继续添加?"); - scanf("%c",&n); - if(n=='Y'||n=='y') - add(); - m++; - } - fclose(fp); -} diff --git a/涓诲嚱鏁.c b/涓诲嚱鏁.c deleted file mode 100644 index 2038109..0000000 --- a/涓诲嚱鏁.c +++ /dev/null @@ -1,45 +0,0 @@ -#include -struct dic_info -{ - char English[40]; - char Chinese[100]; -}word; -void enter() -{ -} -void add() -{ -} -void Delete() -{ -} -void Edit() -{ -} -int main(void) -{ -int choice; -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();break; - } -} -while(choice!=0); -return 0; -} diff --git a/涓诲嚱鏁.exe b/涓诲嚱鏁.exe deleted file mode 100644 index 24545cd..0000000 Binary files a/涓诲嚱鏁.exe and /dev/null differ diff --git a/淇敼.c b/鍒犻櫎.c similarity index 64% rename from 淇敼.c rename to 鍒犻櫎.c index 5b01624..71f8e56 100644 --- a/淇敼.c +++ b/鍒犻櫎.c @@ -1,4 +1,7 @@ -#include +#include +#include +#include +#define LEN sizeof(struct dic_info) struct dic_info { char English[40]; @@ -11,48 +14,39 @@ void enter() void add() { } -void Delete() +void Edit() { } -void Edit() +void Delete() { - int a; - int i; + int m; + char a; char n[40]; - printf("请输入要修改的单词:"); - while(1) + printf("请输入你要删除的单词:\n"); + while(1) { scanf("%s",n); - for(i=0;i<400;i++) - { - if(strcmp(n,inf[i].English)==0) + for(m=0;m<400;m++) { - printf("请输入要修改的内容:\n"); - do + if(strcmp(n,inf[m].English)==0) { - 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); - } + inf[m].English=='\0'; + inf[m].Chinese=='\0'; + printf("删除成功!\n"); + return; + } } - printf("无此单词\n") ; + printf("无此单词\n"); printf("输入y或Y继续操作,输入其他返回菜单\n"); scanf("%c",&a); if(a=='y'||a=='Y') { - Edit(); + Delete(); } break; + } } -} -int main(void) +int main(void) { int choice,i,n=1; char a,b; @@ -73,17 +67,16 @@ switch(choice) { case 1:enter();break; case 2:add();break; - case 3:Delete();break; - case 4:Edit(); - scanf("%c",&a); + case 3:Delete(); for(i=0;i