当前位置:首页 » 课程大全 » 课程设计英汉字典

课程设计英汉字典

发布时间: 2021-03-11 15:51:58

A. c语言课程设计设计电子英汉互译词典。建立一个词库。功能为单词的录入,显示,修改,删除,查找,保存

//给你个参考:【一般是没人愿意去写这种题目的,费时间啊~~】include ;stdafx.h; include windows.h; include stdio.h; include malloc.h; include winbase.h; include process.h; void Search() { char temp[100]; char buffer[2]; char result[100]; printf(;请输入要查询的单词:\n;); scanf(;%s;,amp;temp); buffer[0]=temp[0]; buffer[1]=apos;\0apos;; int ret=GetPrivateProfileString(buffer,temp,0,result,100,;./date.ini;); if(ret;0) printf(;%s\n\n\n\n\n;,result); else printf(;对不起,没有您要查找的单词.\n\n\n\n\n;); } void InsertItem() { char temp[100]; char buffer[2]; char result[100]; printf(;请输入要插入的单词:\n;); scanf(;%s;,amp;temp); printf(;请输入单词的解释:\n;); getchar(); scanf(;%s;,amp;result); buffer[0]=temp[0]; buffer[1]=apos;\0apos;; int ret=WritePrivateProfileString(buffer,temp,result,;./date.ini;); if(ret=0) printf(;插入失败。\n\n\n\n\n;); else printf(;插入成功。\n\n\n\n\n;); } int main(int argc, char* argv[]) { int index; main: printf(;**************MENU***************\n\n;); printf(; 1 英译汉\n;); // printf(;2 汉译英\n;); printf(; 2 插入新的词条\n;); // printf(; 3 删除已有词条\n;); printf(; 3 清空屏幕\n;); printf(; 4 退出\n\n;); printf(;**********************************\n;); do{ printf(;请选择操作(1~4):\n;); scanf(;%d;,amp;index); /*输入选择项*/ }while(index0index;5); /*选择项不在0~4之间重输*/ switch(index) { case 1: Search(); goto main; break; case 2: InsertItem(); goto main; break; case 3: system(;cls;); goto main; break; case 4: return 0; break; default: break; } return 0; }

B. 数据结构课设:关于用java制作一个英汉词典

如果只是课设的话,你直接26个字母是26张表,
把用户传来的单词取首字母,判断属于 哪张表
然后select * from tableA where value =‘用户输入的单词’
把返回值处理显示呗~~~~~。
这么做,因为表比较少,会导致表中的单词量比较大,select速度也是问题。
但是因为是课设,就不考虑那么多了
不然再根据第二个字母,把每张表分成两张也可以 。
不涉及数据库的话,就是把对应的txt里的信息用IO流读出来,存在map中,key是单词,value是词条信息,直接用map.get(“用户单词”);

C. C语言课程设计英汉词典

你好!
这个不是一句两句就能说清的,下面为你提供电子词典,其它要你自己想哦!
#include <windows.h>
#include <stdio.h>
#include <malloc.h>
#include <winbase.h>
#include <process.h>

void Search()
{
char ret;
char temp[100];
char buffer[2];
char result[100];
printf("请输入要查询的单词:\n");
scanf("%s",&temp);
buffer[0]=temp[0];
buffer[1]='\0';
int ret=GetPrivateProfileString(buffer,temp,0,result,100,"./date.ini");
if(ret>0)
printf("%s\n\n\n\n\n",result);
else
printf("对不起,没有您要查找的单词.\n\n\n\n\n");
}

void InsertItem()
{
char temp[100];
char buffer[2];
char result[100];
printf("请输入要插入的单词:\n");
scanf("%s",&temp);
printf("请输入单词的解释:\n");
getchar();
scanf("%s",&result);
buffer[0]=temp[0];
buffer[1]='\0';
int ret=WritePrivateProfileString(buffer,temp,result,"./date.ini");
if(ret=0)
printf("插入失败。\n\n\n\n\n");
else
printf("插入成功。\n\n\n\n\n");
}

int main(int argc, char* argv[])
{
int index;
main:
printf("**************MENU***************\n\n");
printf(" 1 英译汉\n");
// printf("2 汉译英\n");
printf(" 2 插入新的词条\n");
// printf(" 3 删除已有词条\n");
printf(" 3 清空屏幕\n");
printf(" 4 退出\n\n");
printf("**********************************\n");
do{
printf("请选择操作(1~4):\n");
scanf("%d",&index); /*输入选择项*/
}while(index<0||index>5); /*选择项不在0~4之间重输*/
switch(index)
{
case 1:
Search();
goto main;
break;
case 2:
InsertItem();
goto main;
break;
case 3:
system("cls");
goto main;
break;
case 4:
return 0;
break;
default:
break;
}
return 0;
}

D. 我们老师有期末课程设计,关于Java源程序代码的英汉字典的,跪求您的帮忙我只有这么多的财富值,我可充话

package zyhz;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
import java.io.*;
import com.sun.media.sound.*;

public class Dictionary {

public Dictionary() {
}
public static void main(String[] args)
{
dicFrame frame = new dicFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
class dicFrame extends JFrame
{
public dicFrame()
{

setTitle("Dictionary");
setSize(DEFAULT_WIDTH,DEFAULT_HEIGHT);
panel = new JPanel();
add(panel);
//菜单栏
JMenu fileMenu = new JMenu("文件");
JMenuItem ECItem = new JMenuItem("英汉字典");
ECItem.addActionListener(new
AbstractAction(){
public void actionPerformed(ActionEvent event)
{
text2.setText("请在上面输入英文!!!!");
}
});

JMenuItem CEItem = new JMenuItem("汉英字典");
CEItem.addActionListener(new
AbstractAction(){
public void actionPerformed(ActionEvent event)
{
text2.setText("请在上面输入中文!!!!");
}
});

//备份词库
JMenuItem BackupItem = new JMenuItem("备份词库");
BackupItem.addActionListener(new
AbstractAction(){
public void actionPerformed(ActionEvent event)
{
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException ce) {
System.out.println(ce);
}
url = "jdbc:odbc:test";
String fileName;
chooser = new JFileChooser();
frame = new JFrame();
chooser.setDialogTitle("备份词库为");
try {
flag = chooser.showSaveDialog(frame);
} catch (HeadlessException h) {
System.out.println("Save File Dialog ERROR!");
}
if (flag == JFileChooser.APPROVE_OPTION) {
f = chooser.getSelectedFile();
fileName = chooser.getName(f);
fileName = chooser.getSelectedFile().getPath();
try {
File saveFile = new File(fileName);
FileWriter fw = new FileWriter(saveFile);
try

{
con = DriverManager.getConnection(url);
s = con.createStatement();
rs = s.executeQuery("SELECT * from 字典 ");
while (rs.next()) {
String a = rs.getString("单词");
String b = rs.getString("词语解释");
text2.append(a+b+"\n");
}
rs.close();
} catch (Exception ea) {
text2.setText("查询数据失败");
}

fw.write(text2.getText());
fw.close();
} catch (IOException ec) {
text2.setText(fileName);
}
text2.setText("词库备份成功!");
}
}
});
fileMenu.add(ECItem);
fileMenu.add(CEItem);
fileMenu.add(BackupItem);
fileMenu.addSeparator();
//退出监听器
fileMenu.add(new
AbstractAction("退出")
{
public void actionPerformed(ActionEvent event)
{
System.exit(0);
}
});

JMenu editMenu = new JMenu("编辑");
JMenuItem addItem = new JMenuItem("添加词汇");
addItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A,InputEvent.CTRL_MASK));
//菜单栏增加监听器
addItem.addActionListener(new
AbstractAction(){
public void actionPerformed(ActionEvent event)
{
if(text1.getText().equals(""))
text2.setText("没有输入内容!请重新增加!!!");
else
{
String s=text1.getText().trim();
String s1=text2.getText().trim();
text2.setText(new add().jadd(text1.getText().trim(),text2.getText().trim()));
text2.append(s+"\n"+s1+";"+" "+"//"+"该内容已增加!!!");
}
}
});
//菜单栏修改监听器
JMenuItem updateItem = new JMenuItem("修改词汇");
updateItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_U,InputEvent.CTRL_MASK));
updateItem.addActionListener(new
AbstractAction(){
public void actionPerformed(ActionEvent event)
{
if(text1.getText().equals(""))
text2.setText("没输入所要修改的内容!请重新输入!!!!");
else{
String s=text1.getText().trim();
text2.setText(new update().jupdate(text1.getText().trim(),
text2.getText().trim()));
text2.append(s+" "+"//"+"该内容已修改!!!");
}
}
});
//菜单栏删除监听器
JMenuItem deleteItem = new JMenuItem("删除词汇");
deleteItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D,InputEvent.CTRL_MASK));
deleteItem.addActionListener(new
AbstractAction(){
public void actionPerformed(ActionEvent event)
{
if(text1.getText().equals(""))
text2.setText("没输入所要删除的内容!请重新输入!!!!");
else{
String s=text1.getText().trim();
text2.setText(new delete().jdelete(text1.getText().trim()));
text2.append(s+" "+"//"+"该内容已删除!!!");
}
}
});

editMenu.add(addItem);
editMenu.add(updateItem);
editMenu.add(deleteItem);
JMenu helpMenu = new JMenu("Help");
helpMenu.setMnemonic('H');
aboutItem = new JMenuItem("About");
aboutItem.setMnemonic('A');
aboutItem.addActionListener(new
AbstractAction(){
public void actionPerformed(ActionEvent event)
{
new guanyu();
}
});

helpMenu.add(aboutItem);
menubar = new JMenuBar();
setJMenuBar(menubar);
menubar.add(fileMenu);
menubar.add(editMenu);
menubar.add(helpMenu);
//工具栏
label = new JLabel("请输入:");
text1= new JTextField("");
selectButton = new JButton("查询");
//工具栏查询监听器
selectButton.addActionListener(new
AbstractAction(){
public void actionPerformed(ActionEvent event)
{
if(text1.getText().equals(""))
text2.setText("没有输入查询内容!请重新输入!!!");
else text2.setText(new select().jselect(text1.getText().trim()));

}
});
//工具栏增加监听器
addButton = new JButton("增加");
addButton.addActionListener(new
AbstractAction(){
public void actionPerformed(ActionEvent event)
{

if(text1.getText().equals(""))
text2.setText("没有输入内容!请重新增加!!!");
else
{
String s=text1.getText().trim();
String s1=text2.getText().trim();
text2.setText(new add().jadd(text1.getText().trim(),text2.getText().trim()));
text2.append(s+"\n"+s1+";"+" "+"//"+"该内容已增加!!!");
}
}
});
//工具栏修改监听器
updateButton = new JButton("修改");
updateButton.addActionListener(new
AbstractAction(){
public void actionPerformed(ActionEvent event)
{
if(text1.getText().equals(""))
text2.setText("没输入所要修改的内容!请重新输入!!!!");
else{
String s=text1.getText().trim();
text2.setText(new update().jupdate(text1.getText().trim(),
text2.getText().trim()));
text2.append(s+" "+"//"+"该内容已修改!!!");
}
}
});
//工具栏删除监听器
deleteButton = new JButton("删除");
deleteButton.addActionListener(new
AbstractAction(){
public void actionPerformed(ActionEvent event)
{
if(text1.getText().equals(""))
text2.setText("没输入所要删除的内容!请重新输入!!!!");
else{
String s=text1.getText().trim();
text2.setText(new delete().jdelete(text1.getText().trim()));
text2.append(s+" "+"//"+"该内容已删除!!!");
}
}
});

soundButton = new JButton("读音");
soundButton.addActionListener(new
AbstractAction(){
public void actionPerformed(ActionEvent event)
{
JavaSoundAudioClip player;
try{
strsound = text2.getText().trim();
FileInputStream ff = new FileInputStream("sound//"+strsound+".wav");
player = new JavaSoundAudioClip(ff);
player.play();
}
catch(Exception e) {
System.out.println("error");
e.printStackTrace();
}
}
});
//万年历
dateButton = new JButton("万年历");
dateButton.addActionListener(new
AbstractAction() {
public void actionPerformed(ActionEvent event)
{
new calendar();
}
});

toolbar = new JToolBar();
add(toolbar,BorderLayout.NORTH);
toolbar.add(label);
toolbar.add(text1);
toolbar.add(selectButton);
toolbar.add(addButton);
toolbar.add(updateButton);
toolbar.add(deleteButton);
toolbar.add(soundButton);
toolbar.add(dateButton);
text2 = new JTextArea(8,40);
text2.setLineWrap(true);
JScrollPane scroll = new JScrollPane(text2);
add(scroll,BorderLayout.CENTER);
//快捷菜单 剪切,复制,粘贴
JPopupMenu popup= new JPopupMenu();
text2.setComponentPopupMenu(popup);
popup.add(new
AbstractAction("剪切",new ImageIcon("cut.gif"))
{
public void actionPerformed(ActionEvent event)
{
text2.cut();
}
});
popup.add(new
AbstractAction("复制",new ImageIcon(".gif"))
{
public void actionPerformed(ActionEvent event)
{
text2.();
}
});
popup.add(new
AbstractAction("粘贴",new ImageIcon("paste.gif"))
{
public void actionPerformed(ActionEvent event)
{
text2.paste();
}
});
text1.setComponentPopupMenu(popup);
}
public static final int DEFAULT_WIDTH = 400;
public static final int DEFAULT_HEIGHT = 250;
private JPanel panel;
private JMenuBar menubar;
private JToolBar toolbar;
private JLabel label;
private JTextField text1;
private JTextArea text2;
private JButton selectButton;
private JButton addButton;
private JButton updateButton;
private JButton deleteButton;
private JButton soundButton;
private JButton dateButton;
private JMenuItem aboutItem;
private Connection con;
private String url;
private Statement s;
private ResultSet rs;
public BufferedWriter Buffer;
private JFileChooser chooser;
private File f;
private JFrame frame;
private int flag;
private boolean b1;
private String strsound;
}
//查询类
class select {
private Connection con;
private String url;
private PreparedStatement pstmt;
private String sql,zz;
private ResultSet rs;
select() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException ce) {
System.out.println(ce);
}
url = "jdbc:odbc:test";
}
public String jselect(String str) {
try {
con = DriverManager.getConnection(url);
sql = "select 词语解释 from 字典 where 单词=?";
pstmt= con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
pstmt.setString(1,str);
rs = pstmt.executeQuery();
while (rs.next()) {
System.out.print(rs.getString(1));
zz=rs.getString(1);
System.out.println(" ");
}
rs.close();
pstmt.close();
con.close();
} catch (SQLException ce) {
System.out.println(ce);}

return zz;
}
}
//增加类
class add {
private Connection con;
private String url;
private PreparedStatement pstmt;
private String sql,sql1,zz;
private ResultSet rs;
add() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException ce) {
System.out.println(ce);
}
url = "jdbc:odbc:test";
}
public String jadd(String str1,String str2) {
try {
con = DriverManager.getConnection(url);
sql = "insert into 字典 values(?,?)";
pstmt= con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
pstmt.setString(1,str1);
pstmt.setString(2,str2);
pstmt.executeUpdate();
Statement s = con.createStatement();
sql1 = "SELECT * FROM 字典 ";
rs = s.executeQuery(sql1);
while (rs.next()) {
System.out.print(rs.getString(1));
System.out.print(rs.getString(2));
System.out.println(" ");
}
rs.close();
pstmt.close();
con.close();
} catch (SQLException ce) {
System.out.println(ce);}

return zz;
}
}
//修改类
class update {
private Connection con;
private String url;
private PreparedStatement pstmt;
private String sql,sql1,zz;
private ResultSet rs;
update() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException ce) {
System.out.println(ce);
}
url = "jdbc:odbc:test";
}
public String jupdate(String str1,String str2) {
try {
con = DriverManager.getConnection(url);
sql = "UPDATE 字典 SET 词语解释=? WHERE 单词=?";
pstmt= con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
pstmt.setString(1,str1);
pstmt.setString(2,str2);
pstmt.executeUpdate();
Statement s = con.createStatement();
sql1 = "SELECT * FROM 字典 ";
rs = s.executeQuery(sql1);
while (rs.next()) {
System.out.print(rs.getString(1));
System.out.print(rs.getString(2));
System.out.println(" ");
}
rs.close();
pstmt.close();
con.close();
} catch (SQLException ce) {
System.out.println(ce);}
return zz;
}
}
//删除类
class delete {
private Connection con;
private String url;
private PreparedStatement pstmt;
private String sql,sql1,zz;
private ResultSet rs;
delete() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException ce) {
System.out.println(ce);
}
url = "jdbc:odbc:test";
}
public String jdelete(String str1) {
try {
con = DriverManager.getConnection(url);
sql = "delete 字典 WHERE 单词=?";
pstmt= con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
pstmt.setString(1,str1);
pstmt.executeUpdate();
Statement s = con.createStatement();
sql1 = "SELECT * FROM 字典 ";
rs = s.executeQuery(sql1);
while (rs.next()) {
System.out.print(rs.getString(1));
System.out.print(rs.getString(2));
System.out.println(" ");
}
rs.close();
pstmt.close();
con.close();
} catch (SQLException ce) {
System.out.println(ce);}
return zz;
}
}
还有个数据库,如果你能留个邮箱,我把整份程序传给你~希望能帮到你

E. 电子英汉词典程序设计

这么深的c语言,还没学到,虽然我的专业也学c语言程序与设计。不太懂,也无法给你提供建议。

F. JAVA课题设计:电子英汉词典

自己上网络搜索

G. C语言编程题,设计英汉词典的课设题型

#include<stdio.h>

#include<string.h>

#include<malloc.h>

#include<math.h>

#define min(A,B) (A<B?A:B)

#define max(A,B) (A<B?B:A)

typedef struct Dict

{

char en[30];

char zh[30];

struct Dict* next;

} Dict;

int main(void)

{

Dict* head = 0;


int stucount=0;//数量


while(1)

{

printf("输入操作号:1:词汇输入 2:浏览 3:汉英 4:英汉 5:删除 6:退出:");


int quest;

scanf("%d",&quest);

scanf("%*[^ ]");

if(quest==6)break;

else if(quest==1)

{

Dict* newDict = (Dict*)malloc(sizeof(Dict));

printf("请输入中文:");

scanf("%29s", newDict->zh);

scanf("%*[^ ]");

printf("请输入英文:");

scanf("%29s", newDict->en);

scanf("%*[^ ]");

//插入链表首,这样最新添加的显示在最上面,容易看见效果

newDict->next=head;

head=newDict;


++stucount;

}

else if(quest==2)

{

if(head==0)

printf("没有单词! ");

else

{

printf("开始浏览单词: ");

while(1)

int st=0,en=min(st+10,stucount);

{

printf("浏览:%d个到%d个单词 ",st+1,en);

Dict* stu = head;

for(int i=0; i<st; ++i)

{

stu=stu->next;

}

for(int i=st; i<en; ++i)

{

printf("中文:%s 英文:%s ",stu->en,stu->zh);

stu=stu->next;

}

printf("输入操作号:1 向后翻页;2 向前翻页;-1 退出:");

int squest;

scanf("%d",&squest);

scanf("%*[^ ]");

if(squest==1)

{

if(en!=stucount) st=en;

}

else if(squest==2)

{

st=max(0,st-10);

}

else if(squest==-1)break;

en=min(st+10,stucount);

}

}

}

else if(quest==3 || quest==4 || quest==5)

{

char a[30];

if(quest==3)printf("请输入汉语词汇:");

else if(quest==4) printf("请输入英语词汇:");

else if(quest==5) printf("请输入待删除的词汇(汉英均可):");


scanf("%29s", a);

scanf("%*[^ ]");


Dict* stu = head;

Dict* lststu = 0;

int flag=0;

while(stu!=0 && flag==0)

{

if(quest==3)

{

if(strcmp(a,stu->zh)==0)

{

printf("英语为:%s ",stu->en);

flag=1;

}

}

else if(quest==4)

{

if(strcmp(a,stu->en)==0)

{

printf("汉语为:%s ",stu->zh);

flag=1;

}

}

else if(quest==5)

{

if(strcmp(a,stu->en)==0 || strcmp(a,stu->zh)==0)

{

stucount--;

if(lststu!=0)

lststu -> next = stu -> next;

else

head = stu -> next;

printf("已删除! ");

flag=1;

}

}


lststu=stu;

stu=stu->next;

}

if(flag==0)

{

printf("没有查到词汇! ");

}

}

}

return 0;

}

你看看对不对,能不能跑吧。如果有新的需求我可以继续写。代码应该很清晰了,如果你哪不懂可以给你解释。欢迎追问。

H. 谁做过王栋主编的vb课程设计中的英汉词典,谁有源代码,希望能够发给我,不甚感激~

http://wenku..com/view/7735592458fb770bf78a5579.html

热点内容
武汉大学学生会辅导员寄语 发布:2021-03-16 21:44:16 浏览:612
七年级学生作文辅导学案 发布:2021-03-16 21:42:09 浏览:1
不屑弟高考成绩 发布:2021-03-16 21:40:59 浏览:754
大学毕业证会有成绩单 发布:2021-03-16 21:40:07 浏览:756
2017信阳学院辅导员招聘名单 发布:2021-03-16 21:40:02 浏览:800
查询重庆2018中考成绩查询 发布:2021-03-16 21:39:58 浏览:21
结业考试成绩怎么查询 发布:2021-03-16 21:28:40 浏览:679
14中医医师资格笔试考试成绩查分 发布:2021-03-16 21:28:39 浏览:655
名著赏析课程标准 发布:2021-03-16 21:27:57 浏览:881
北京大学商业领袖高端培训课程 发布:2021-03-16 21:27:41 浏览:919