全球旧事资料 分类
数据结构与VC编程实习实习报告
学生姓名:学号:
专业班级:计算机09级3班指导教师:宋会英
2011年7月7日
f实习题目
编译码系统的设计
一、任务描述及要求内容:(1)读入待编码的文字,统计各字符出现的频率(2)构造哈夫曼树(3)得到各字符的哈夫曼编码(4)对原文进行编码(5)发送、接收(6)还原(译码)收到的文字(7)利用哈夫曼树,从根到叶子读0、1序列,直到终止,再读下一个字符(8)比较(校验)基本要求:基本要求(85分)合理设计窗口界面,待编码的文字通过窗口的编辑界面(类似记事本的编辑界面)录入,在界面上显示各个字符出现的频率及哈夫曼编码,对原文编码并在界面上显示出来;对译码文字还原,显示在界面上与原文对照。功能菜单或按钮自行设计,以合理为目的。扩展要求:扩展要求(15分)利用socket进行电文的发送与接收,加5分;
f在界面上显示出哈夫曼树及其生成过程,加10分。
二、概要设计1.抽象数据类型ADTHuffma
TreeDATA:chIfobmifo编码信息i
tpos当前bmifo的大小CStri
gbmNoderoot
operatio
s:
voiddeleteTreeNodet删除voidmergeTreeNodeht1Nodeht2Nodefathervoidbia
maNodesubTree编码voidDrawi
txi
tyi
txlasti
tylastCDCpDCNodet树形输出voidcreateTreechIfowi
t
创建树
fvoidDrawi
txi
tyi
txlasti
tylastCDCpDCvoidbia
mabia
maroot
CStri
gjmTextCStri
gtext解码文本CStri
gbmTextCStri
gtext编码文本voidstartCStri
gstr根据字符串建树chIfotextifoCStri
gstri
tsize统计字符频率2.整个程序包含功能模块及模块间的调用关系接收信息发送信息
对话框
接收哈夫曼树
发送哈夫曼树
三、详细设计1.虚拟实现
f即数据结构的C语言描述classHuffma
TreeprotectedvoiddeleteTreeNodetvoidmergeTreeNodeht1Nodeht2Nodefathervoidbia
maNodesubTreevoidDrawi
txi
tyi
txlasti
tylastCDCpDCNodetvoidcreateTreechIfowi
t
publicchIfobmifo编码信息i
tpos
Huffma
TreechIfowi
t
Huffma
TreerootNULLHuffma
Tree
voidDrawi
txi
tyi
txlasti
tylastCDCpDC
fvoidbia
mabia
maroot
CStri
gjmTextCStri
gtextCStri
gbmTextCStri
gtextvoidstartCStri
gstrchIfotextifoCStri
gstri
tsizeprivateCStri
gbmNoderootclasschIfopubliccharch字符double
出现次数doublegai出现概率CStri
gbm编码结果
chIfo
0gai0
fvoidcchcch
c
gaicgaibmcbm
operatorchIfo
booloperatorchIfocretur
gaicgaitruefalsebooloperatorchIfocretur
gaicgaitruefalsebooloperatorchIfocretur

gr
好听全球资料 返回顶部