當前位置:首頁 » 課程大全 » 課程設計英漢字典

課程設計英漢字典

發布時間: 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