ImageVerifierCode 换一换
格式:DOCX , 页数:21 ,大小:97.81KB ,
资源ID:24454992      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/24454992.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(计算机实习报告输入法.docx)为本站会员(b****4)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

计算机实习报告输入法.docx

1、计算机实习报告输入法一、开发任务开发任务的具体要求。拼音输入法:通过编程实现拼音输入并找到相应汉字后打印出来。 二、需求分析(这一部分主要是确定要做什么,以及问题的边界。如对于本例,主要给出游戏软件的功能,描述操作的特性等。具体来说,就是给出程序的基本功能和性能,设计问题的输入/输出)1说明自己针对这个任务将完成哪些功能的设计。拼音输入法的功能有:(1)提供输入法主界面。包括键盘,汉字选项以及输出框。如图所示:(2)输入汉字功能。点击模拟键盘实现输入,右侧拼音、汉字选择即可。(3)汉字输出。用户选中相应汉字后即可在输入框中显示,如图:2说明程序将会具有什么样的性能:程序中有如下性能:(1)点击

2、键盘按钮输入相应拼音,并显示所有拼音组合情况。(2)点击选择拼音即可出现相应汉字,点击汉字即可显示在输入框中。(3)点击清除即可实现清除拼音,点击标点即可选择标点输入。三、程序设计(这一部分主要是说怎么做,以及语言环境对问题处理的特殊影响。如下例所示,游戏区域的表示,下坠物的形状表示,辅助数据结构,结果输出格式。具体来说,就是给出程序的数据结构,模块划分,主程序结构)操作区域由编辑框、按钮、列表框组成。如下图所示:针对需要做如下设计:(1)数据结构设计设置CString 类型的input,用于存储按键点击输入。(2)界面设计输入框由编辑框组成,用于输出汉字。模拟按键区域,由12个按钮组成,用于

3、用户的输入。拼音汉字选择处由列表框组成,实现汉字显示以及用户选择。(3)操作代码设计(a)键盘拼音按钮操作(以按键2为例) 用户点击完成,分别将a,b,c赋值给input数组,并将input数组中的信息与文件中的拼音比较,若存在相同则显示到拼音列表即可。 case 2: if(input_count=0) input_count=3; tempm+=a; tempm+=b; tempm+=c; else for(int k=0;kinput_count;k+) tempm+=inputk+_T(a); tempm+=inputk+_T(b); tempm+=inputk+_T(c); for(

4、i=0;im;i+) inputi=tempi; input_count=m; Update_em_listctrl(); break; (b)键盘标点按钮操作点击标点按钮后,将存放标点的数组所有值显示到列表控件即可。 CString biaodian7=_T(,),_T(.),_T(、),_T(:),_T(;),_T(?),_T(!);(c)键盘清除按钮操作清空两个列表以及input数组,并将输入计数置零。 em_listctrl.DeleteAllItems(); hm_listctrl.DeleteAllItems(); for(int i=0;iinput_count;i+) inpu

5、ti=; input_count=0;(d)选中拼音列表选项操作清空汉字列表后,取出列表中的拼音并与汉字表文本文件中对比,找到相同的则将汉字全部赋值给汉字列表。(e)选中汉字列表选项操作取出列表中选中的汉字,赋值给输入框即可显示。显示完成则清空拼音、汉字列表以及input数组,便于下一次继续输入。四、程序实现(这一部分主要是说子程序的实现,以及引用的语言资源。具体来说,就是给出程序模块的实现)(1)界面设计实现 开始运行界面 汉字输入界面(2)操作代码实现(a)按钮点击代码实现void CMyDlg:Button_Handle(int n) /所有的按键处理函数 CString biaodia

6、n7=_T(,),_T(.),_T(、),_T(:),_T(;),_T(?),_T(!); CString temp10000; int j,i; if(flag_123_or_en=1) /当前键盘为数字 input_cstring.Format(_T(%s%d),input_cstring,n); UpdateData(false); /刷新变量的值到控件 else /当前键盘为字符和标点符号 UpdateData(true); /刷新控件的值到变量 int m=0; switch(n) case 0: /点击标点按钮 hm_listctrl.DeleteAllItems(); /先清空汉

7、字列表框中的值 for(j=0;j7;j+) hm_listctrl.InsertItem(j,_T(); hm_listctrl.SetItemText(j,0,biaodianj); break; case 1: /点击按钮1 input_cstring.Format(_T(%s ),input_cstring); UpdateData(false); break; case 2: /点击按钮2 if(input_count=0) input_count=3; tempm+=a; tempm+=b; tempm+=c; else for(int k=0;kinput_count;k+) t

8、empm+=inputk+_T(a); tempm+=inputk+_T(b); tempm+=inputk+_T(c); for(i=0;im;i+) inputi=tempi; input_count=m; Update_em_listctrl(); break; case 3: /点击按钮3 if(input_count=0) input_count=3; tempm+=d; tempm+=e; tempm+=f; else for(int k=0;kinput_count;k+) tempm+=inputk+_T(d); tempm+=inputk+_T(e); tempm+=inpu

9、tk+_T(f); for(i=0;im;i+) inputi=tempi; input_count=m; Update_em_listctrl(); break; case 4: /点击按钮4 if(input_count=0) input_count=3; tempm+=g; tempm+=h; tempm+=i; else for(int k=0;kinput_count;k+) tempm+=inputk+_T(g); tempm+=inputk+_T(h); tempm+=inputk+_T(i); for(i=0;im;i+) inputi=tempi; input_count=m

10、; Update_em_listctrl(); break; case 5: /点击按钮5 if(input_count=0) input_count=3; tempm+=j; tempm+=k; tempm+=l; else for(int k=0;kinput_count;k+) tempm+=inputk+_T(j); tempm+=inputk+_T(k); tempm+=inputk+_T(l); for( i=0;im;i+) inputi=tempi; input_count=m; Update_em_listctrl(); break; case 6: /点击按钮6 if(in

11、put_count=0) input_count=3; tempm+=m; tempm+=n; tempm+=o; else for(int k=0;kinput_count;k+) tempm+=inputk+_T(m); tempm+=inputk+_T(n); tempm+=inputk+_T(o); for(i=0;im;i+) inputi=tempi; input_count=m; Update_em_listctrl(); break; case 7: /点击按钮7 if(input_count=0) input_count=4; tempm+=p; tempm+=q; temp

12、m+=r; tempm+=s; else for(int k=0;kinput_count;k+) tempm+=inputk+_T(p); tempm+=inputk+_T(q); tempm+=inputk+_T(r); tempm+=inputk+_T(s); for(i=0;im;i+) inputi=tempi; input_count=m; Update_em_listctrl(); break; case 8: /点击按钮8 if(input_count=0) input_count=3; tempm+=t; tempm+=u; tempm+=v; else for(int k=

13、0;kinput_count;k+) tempm+=inputk+_T(t); tempm+=inputk+_T(u); tempm+=inputk+_T(v); for(i=0;im;i+) inputi=tempi; input_count=m; Update_em_listctrl(); break; case 9: /点击按钮9 if(input_count=0) input_count=4; tempm+=w; tempm+=x; tempm+=y; tempm+=z; else for(int k=0;kinput_count;k+) tempm+=inputk+_T(w); te

14、mpm+=inputk+_T(x); tempm+=inputk+_T(y); tempm+=inputk+_T(z); for(i=0;im;i+) inputi=tempi; input_count=m; Update_em_listctrl(); break; (b)拼音列表点击代码void CMyDlg:OnClickList2(NMHDR* pNMHDR, LRESULT* pResult) / TODO: Add your control notification handler code here int pos; CString item; FILE *file; hm_lis

15、tctrl.DeleteAllItems(); /删除汉字列表所有项目 pos=em_listctrl.GetSelectionMark(); /找到点击行数 item=em_listctrl.GetItemText(pos,0); /获取拼音列表点击的拼音 for(int i=0;i453;i+) if(item=pinyini) if(file=fopen(汉字库.txt,r)=NULL) /访问汉字库文本文档 printf(打开文件失败n); return; CString hanzi; char temp200; for(int j=0;ji;j+) fgets(temp,200,fi

16、le); fscanf(file,%s,temp); fscanf(file,%s,temp); hanzi=temp; int kk=0; for(int k=0;khanzi.GetLength();k=k+2) hm_listctrl.InsertItem(k,_T(); CString t=hanzi.Mid(k,2); hm_listctrl.SetItemText(kk,0,t); /找到匹配汉字并显示到汉字列表框 kk+; fclose(file); /关闭文件 break; *pResult = 0;(c)汉字列表点击函数代码void CMyDlg:OnClickList1(N

17、MHDR* pNMHDR, LRESULT* pResult) / TODO: Add your control notification handler code here int pos; pos=hm_listctrl.GetSelectionMark(); /找到点击行数 UpdateData(true); input_cstring+=hm_listctrl.GetItemText(pos,0); /获取选中文本并显示到输入框 UpdateData(false); hm_listctrl.DeleteAllItems(); /删除拼音列表所有项目 em_listctrl.Delete

18、AllItems(); /删除汉字列表所有项目 for(int i=0;iinput_count;i+) inputi=; /清空输入数组 input_count=0; /输入计数置零 *pResult = 0;(d)相关辅助函数对话框初始化函数,包括列表框的初始化,按钮的初始化等。BOOL CMyDlg:OnInitDialog() CDialog:OnInitDialog(); / Add About. menu item to system menu. / IDM_ABOUTBOX must be in the system command range. ASSERT(IDM_ABOUT

19、BOX & 0xFFF0) = IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX AppendMenu(MF_SEPARATOR); pSysMenu-AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); / Set the icon for this dialog. The framework does this automatically / when the applications main window is not a dialog SetIcon(m_hIcon, TRUE); / Set big icon Se

20、tIcon(m_hIcon, FALSE); / Set small icon / TODO: Add extra initialization here LONG style; style=:GetWindowLong(em_listctrl.m_hWnd,GWL_STYLE); style&=(LVS_TYPEMASK); style&=(LVS_EDITLABELS); style|=LVS_REPORT; :SetWindowLong(em_listctrl.m_hWnd,GWL_STYLE,style|LVS_NOLABELWRAP|LVS_SHOWSELALWAYS); LONG

21、estyle; estyle=em_listctrl.GetExtendedStyle(); estyle|=LVS_EX_FULLROWSELECT; estyle|=LVS_EX_GRIDLINES; em_listctrl.SetExtendedStyle(estyle); em_listctrl.InsertColumn(0,_T(拼音),LVCFMT_LEFT,60); style=:GetWindowLong(hm_listctrl.m_hWnd,GWL_STYLE); style&=(LVS_TYPEMASK); style&=(LVS_EDITLABELS); style|=L

22、VS_REPORT; :SetWindowLong(hm_listctrl.m_hWnd,GWL_STYLE,style|LVS_NOLABELWRAP|LVS_SHOWSELALWAYS); estyle=hm_listctrl.GetExtendedStyle(); estyle|=LVS_EX_FULLROWSELECT; estyle|=LVS_EX_GRIDLINES; hm_listctrl.SetExtendedStyle(estyle); hm_listctrl.InsertColumn(0,_T(汉字),LVCFMT_LEFT,60); flag_123_or_en=0; /

23、键盘初始化时为字母 input_count=0; /初始化时输入的字符数组合数位0 /初始化时先读入所有拼音 FILE *file; if(file=fopen(拼音库.txt,r)=NULL) printf(打开文件失败n); return 0; char temp10; for(int i=0;i453;i+) fscanf(file,%s,temp); /pinyini.Format(_T(%s),temp); pinyini=temp; fclose(file); return TRUE; / return TRUE unless you set the focus to a cont

24、rol更新拼音列表框的函数代码void CMyDlg:Update_em_listctrl() em_listctrl.DeleteAllItems(); /清空拼音列表中的所有内容 int k=0; for(int i=0;iinput_count;i+) for(int j=0;j453;j+) if(inputi=pinyinj) em_listctrl.InsertItem(k,_T(); em_listctrl.SetItemText(k,0,inputi); k+; break; (3)函数和过程主要调用关系按钮单击事件 利用 switch case 语句,根据按钮的不同数值,转换至不同的操作。五、程序测试(这一部分主要是说用什么数据测试程序,保证程序的每一条分支上的语句都被调试。具体来说,就是进行程序白盒测试)拼音输入法测试操作如下。开始界面: 输入界面六、设计小结(这一部分分析程序的优缺点,提出可能的改进方案)本程序完成了拼音输入法基本输入的功能。 优点是,外观一目了然,方便用户的操作。缺点是,每次只能输入一个字,增加了输入难度。七、使用说明(这一部分主要是说程序安装说明和启动。具体来说,就是给出

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1