/*
* Copyright (c) 2010,****科技有限責任公司
* All rights reserved.
*
* 檔案名稱:201000170.c
* 檔案標識:……未提交 | 未連結詞庫 | 作者測試版…………………………
* 摘 要:電子詞典效果
*
* 目前的版本:2.1
* 作 者:王軍亮
* 完成日期:2010-4-24
*
* 取代版本:2.0
* 原作者 :王軍亮
* 完成日期:2010-4-20
*/
#include <stdio.h>
#include <string.h>
void main()
{
char *door, word[3];
void FindChinese();
void FindEnglish();
door = word;
//print a banner
printf("/t|*********************電子詞典類比軟體*********************|/n");
printf("/t 1.先選擇詞典:輸入字母e/c選擇英漢還是漢英詞典/n");
printf("/t 2.輸入要查詢的詞條,斷行符號結束輸入/n");
printf("/t 3.輸入字母u返回主菜單,重新選擇詞典/n");
printf("/t 4.退出:主菜單下輸入字母 bye 退出此此電子詞典程式/n");
printf("/t -----------(c) 2010,鄭州閃電行科技有限責任公司----------- /n");
printf("/t|******************** All rights reserved******************|/n");
while(1)//go to end in the while(...)
{
printf("英漢詞典(e)/漢英詞典(c)?");
scanf("%s", door);
//go to FindChinese
if(strcmp(door,"e")==0)
{
FindChinese();////////////function...
}
//go to FindEnglish
else
if(strcmp(door,"c")==0)
{
FindEnglish();/////////////function...
}
else//go to the end
if(strcmp(door,"bye")==0) break;
else//error
printf("invalid input,please try again……/n");
}//the end of while(...)
}
//the 1st dictionary
void FindChinese()
{
char *p, eword[20] = "r";
p=eword;
while(1)
{
int f=0;
printf("Enter the English word you want to look up:(enter u to go upper lever)/n");
scanf("%s",p);
//should be checked here.........
if(strcmp(p,"u")==0) break;//go upper
if(f==0 && (strcmp(p,"int")==0)) {f=1; printf("/n%s: 整形/n",p);}
if(f==0 && strcmp(p,"float")==0) {f=1; printf("/n%s: 浮點型/n",p);}
if(f==0 && strcmp(p,"sunny")==0) {f=1; printf("/n%s: 陽光燦爛的/n",p);}
//more words here^_^
//more words here^_^ 連結詞庫 | 介面確定後需要繼續修改...
//more words here^_^
if(f==0) printf("/nsorry, can't find the word/n");
}
}
//the 2nd dictionary
void FindEnglish()
{
char *p, cword[20] = "r";
p=cword;
while(1)
{
int f=0;
printf("請輸入您想尋找的中文詞語:(輸入u返回上層)/n");
scanf("%s",p);
//should be checked here.........
if(strcmp(p,"u")==0) break;//go upper
if(f==0 && (strcmp(p,"整形")==0)) {f=1; printf("/n%s: int/n",p);}
if(f==0 && strcmp(p,"浮點型")==0) {f=1; printf("/n%s: float/n",p);}
if(f==0 && strcmp(p,"長整型")==0) {f=1; printf("/n%s: long/n",p);}
//more words here^_^
//more words here^_^ 連結詞庫 | 介面確定後需要繼續修改...
//more words here^_^
if(f==0) printf("/n很抱歉,沒有找到這個中文詞條/n");
}
}