C++程序相似度检测算法的设计与实现
时间:2022-02-08 15:27 来源:毕业论文 作者:毕业论文 点击:次
摘要程序设计对于当今工作有很重的影响,因此学习程序语言对于计算机及相关专业的 学生是必不可少的。随着互联网的迅速发展,为我们带来便利的同时,也为一些学生搜 寻代码,不劳而获带来了方便之处。对于程序的代码进行相似度检测,可以帮助教师检 查学生所提交的代码是否出现重复,减少教师的额外工作量。当今代码相似度检测技术 主要分为两大类:属性计数技术和结构度量技术。本文首先分析了目前较为完善的检测 系统,之后分别采用属性计数技术和结构度量技术对代码的相似度检测进行实现。77726 本文实现的功能主要用于检测 C++语言编写程序的相似度情况。本文首先通过预处 理对代码的无用注释和空白等做删除处理。接着统计程序的属性,计算出程序间属性的 相似度。随后基于 LCS 字符串匹配算法对程序进行结构度量检测,并根据匹配得到的结 果计算出程序间相似程度的数值,将这个数值作为相似度判定的度量值。最后,通过两 组实验数据对本文所是实现的功能进行验证和分析。实验结果表明,本程序对于普通的 修改基本能够检测出来,对于较高难度的结构修改,会有一定的错误率。 毕业论文关键词 程序代码,相似度,度量,LCS 算法 毕 业 设 计 说 明 书 外 文 摘 要 Title Design and Implementation of A Program similarity Detection Algorithm Abstract Programming nowadays has a very important influence on people’s work, so learning programming language is very necessary for students who major in Computer Science and other relevant fields。 With the rapid development of Internet, Internet can bring convenience for us, however, it can provide students an easy way to find code without working hard at the same time。 For detecting programs’ code similarity, it can help teachers check students’ code whether they are copied by others, and reduce the extra workload of teachers。 Today’s code similarity detection technology is mainly pided into two categories: attribute counting technology and structural measurement technology。 This article first analyses current relatively perfect detection system, and then using both attribute counting technology and structural measurement technology to detect the similarity of code。 In this paper, the function is mainly used for detecting the similarity of programs that are written in C++ language。 In the paper, the program first using the pretreatment of code to delete the useless blank and comments。 And then the program statistics the attributes, compute the similarity of code。 Next based on the LCS string matching algorithm, the software tests the structure of the programs, and according to this results program can calculate the similarity value, and this value can be used as final value。 Finally, by two groups of experimental data, this paper analyzes and verifies the function of the program。 The experimental results show that the application can detect most fundamental modifications, when detecting some difficult structural modifications, it will produce some error rate。 Keywords Code, Similarity, Measure, LCS Algorithm 本科毕业设计说明书 第 I 页 目 录 第一章 绪论 1 1。1 研究的背景和意义 1 1。3 研究内容 3 1 。4 (责任编辑:qin) |