久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3339|回復: 1
打印 上一主題 下一主題
收起左側

c語言電子詞典源程序

[復制鏈接]
跳轉到指定樓層
樓主
ID:60266 發表于 2014-8-18 21:50 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
#include<stdio.h>

#include<string.h>
#include<malloc.h>
#include<stdlib.h>
#define LEN sizeof (struct cte)   /*宏定義*/
/*..........................
............................
............................*/
struct cte                        /*結構體定義*/
{
char  chinese[100] ;
char  English[100] ;
struct cte *next;
};/*........................
............................
............................
*/
struct cte *insert(struct cte *head)  /*單詞添加*/
{
struct cte *p1,*p2,*p3;
unsigned int a , b;
p1=p2=head;
if (head == 0)
{
p1 = (struct cte *)malloc(LEN);
printf("1.中譯英\n");
printf("2.英譯中\n");
scanf("%d",&a);
if (a==1)
{
printf("請輸入中文:\n");
scanf("%s",&p1->chinese);
printf("please input english:\n");
scanf("%s",&p1->English);
}
else if (a==2)
{
printf("please input english:\n");
scanf("%s",&p1->English);
printf("請輸入中文:\n");
scanf("%s",&p1->chinese);
}
else
{
printf ("輸入有誤\n");
}
head = p1;
head->next=0;
}
else
{
p1=(struct cte *)malloc(LEN);
p3=head->next;
head->next=p1;
p1->next=p3;
printf("1.中譯英\n");
printf("2.英譯中\n");
scanf("%d",&b);
if (b==1)
{
printf("請輸入中文:\n");
scanf("%s",&p1->chinese);
printf("please input english:\n");
scanf("%s",&p1->English);
}
else if (b==2)
{
printf("please input english:\n");
scanf("%s",&p1->English);
printf("請輸入中文:\n");
scanf("%s",&p1->chinese);
}
else
{
printf("輸入有誤\n");
}
}
return head;
}
/*...........................
.............................
.............................*/
void cscan(struct cte *head)   /*漢譯英*/
{
struct cte *p;
char a[100];
printf("請輸入:");
scanf("%s",a);
p = head;
if(head==0)
printf("本詞典當前為空\n");
while(p!=0)
{
if (strcmp(a,p->chinese)==0)
{
         printf("English:%s",p->English);
  p=0;
}
else if (strcmp(a,p->chinese) != 0)
p=p->next;
if(p==0)
printf("沒這詞語");
}
system("pause");
}
/*............................
..............................
..............................*/
void escan(struct cte *head)   /*英譯漢*/
{
struct cte *p;
char a[100];
printf("please input a word:");
scanf("%s",a);
p=head;
if(head==0)
printf("本詞典當前為空\n");
while(p!=0)
{
if (strcmp(a,p->English) == 0)
{
printf("中文:%s",p->chinese);
p = p->next;
}
else if (strcmp(a,p->English)!=0)
p = p->next;
if(p==0)
printf("沒這詞語");
}
system("pause");
}
/*.............................
...............................
...............................*/
void print (struct cte *head)  /*詞典查看*/
{
struct cte *p;
p = head;
if(p==0)
printf("該詞典沒有任何記錄\n");
while  (p !=0)
{
printf("中文:%s English:%s\n",p->chinese,p->English);
p = p->next;
}
system("pause");
}
/*..............................
................................
................................*/
void main()
{  
void cscan(struct cte *head);
void escan(struct cte *head);
struct cte  *insert(struct cte *head);
struct cte *start(void);
struct cte *B=0;
int a,b=0,c;
/*struct cte n;*/
while(1)
{   
        printf("\n\n\n\n\t\t\t\t");
        printf("************\n\t\t\t\t");
        printf("1.漢譯英\n\t\t\t\t");
    printf("2.英譯漢\n\t\t\t\t");
    printf("3.添加新詞\n\t\t\t\t");
    printf("4.查看詞典\n\t\t\t\t");
        printf("5.清除屏幕\n\t\t\t\t");
        printf("************\n\n");
        printf("請選擇\n");

        scanf("%d",&a);
if(a==1)
{
cscan(B);
system("cls");
}
else if(a==2)
{
escan(B);
system("cls");
}
else if(a==3)
{
B = insert(B);
system("cls");
}
else if(a==4)
{
print(B);
system("cls");
}
else if(a==5)
system("cls");
else
printf("輸入有誤:");
}
}

                                                                                            

                                                                               
                                                                                                                                                       
                                                       

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復

使用道具 舉報

沙發
ID:175839 發表于 2017-12-20 02:22 | 只看該作者
這個程序在Visual C++6.0中運行不了
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

手機版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表
主站蜘蛛池模板: 人人干天天干 | 五月激情婷婷网 | 午夜视频网站 | 欧美一级欧美一级在线播放 | 成人三级视频 | 97狠狠干 | 波多野结衣在线观看一区二区三区 | 日韩成人精品 | 欧美成人一区二免费视频软件 | 国产成人精品网站 | 黄色亚洲| 国产日韩欧美在线播放 | 欧美精品综合在线 | 欧美成人激情视频 | 欧美精品在欧美一区二区少妇 | 成人小视频在线观看 | 深夜福利影院 | 精品久久久av| 老司机免费视频 | 色视频一区二区 | 亚洲精品9999久久久久 | 日本a视频 | 欧美精品在线免费观看 | 久久99精品久久久久久国产越南 | 午夜成人免费视频 | 亚洲午夜av久久乱码 | 羞羞在线视频 | 天天射夜夜操 | 一区二区三区四区在线视频 | 成人免费看电影 | 亚洲精品乱码8久久久久久日本 | 黄色一级片视频 | 一区二区视频在线 | a级片在线观看 | 欧美精品一区二区三区在线播放 | 波多野结衣先锋影音 | 国产91综合一区在线观看 | 国产激情视频网 | 日韩播放 | 久久网一区二区 | 欧美日韩亚洲国产综合 |