资源简介
主要是检查作业是否有抄袭情况,他可以读取txt格式的文本,是用c++写的

代码片段和文件信息
#include “cpd.h“
using namespace std;
// Debug functions
/*
void OutputHashTable(HawkEye he long Key)
{
cout << “==Outputting Hash Table==“ << endl;
FileBlock *ndPtr= he.HashTable[Key];
while( ndPtr != NULL ){
cout << ndPtr->HashKey << endl;
ndPtr= ndPtr->Next;
}
cout << “==Output Completed==“ << endl;
}
*/
void HawkEye::OutputFileBlock(FileBlock *ndPtr)
{
#ifdef DEBUGFUNCTION
if(ndPtr == NULL)
cout << “Current FileBlock is NULL!!!“ << endl;
else{
cout << “==Outputting File Block==“ << endl;
cout << “StartPoint: “ << ndPtr->StartPoint << endl;
cout << “Length: “ << ndPtr->Length << endl;
cout << “FileName: “ << ndPtr->FileName << endl;
cout << “HashKey: “ << ndPtr->HashKey << endl;
cout << “==Output Completed==“ << endl;
}
#endif
/*
cout << “==========Hash table statistic===========“ << endl;
for(i= 0; i< MAX; i++){
FileBlock *fbp= HashTable[i];
int counter= 0;
while( fbp != NULL ){
counter++;
fbp=fbp->Next;
}
cout << i << ‘:‘ << counter << endl;
}
*/
}
/*
void Scan(long key)
{
FileBlock *ndPtr= HashTable[key];
int Counter= 0;
while( ndPtr != NULL ){
Counter++;
ndPtr= ndPtr->Next;
}
cout << “Scanning completed 1003 has “ << Counter << “ elements.“ << endl;
}
*/
// Independent function
// Repo
string HawkEye::Suck(FileBlock *fbp)
{
#ifdef DEBUG_Suck
cout << “To Be Sucked: “ << endl;
OutputFileBlock(fbp);
#endif
string ToBeReturned= ““;
fstream fin;
fin.open( (fbp->FileName).c_str() fstream::in );
if( !fin.good() )
cout << “Open file error in Suck()“ << endl;
fin.seekg(fbp->StartPoint);
char ch;
for(i= 0; i< fbp->Length; i++){
fin.read( &ch sizeof(char) );
ToBeReturned+= ch;
}
fin.close();
#ifdef DEBUG_Suck
cout << “Sucked Out: “ << ToBeReturned << endl;
#endif
return ToBeReturned;
}
string HawkEye::GetFileName(string AbsPath)
{
int dashpos dotpos;
dashpos= AbsPath.rfind(‘/‘);
if(dashpos == (int)string::npos)
//! If it is already the relative path
dashpos= -1;
dotpos= AbsPath.rfind(‘.‘);
return AbsPath.substr(dashpos+1 dotpos-dashpos-1);
}
string HawkEye::GetSuffix(string AbsPath)
{
unsigned int dashpos dotpos;
dotpos= AbsPath.rfind(‘.‘);
if(dotpos == string::npos)
return ““;
dashpos= AbsPath.rfind(‘/‘);
if(dashpos == string::npos)
//! If it is already the relative path
dashpos= 0;
return ‘.‘ + AbsPath.substr(dotpos+1 AbsPath.size()-dotpos-1);
}
// Independent function
int HawkEye::LCS(string astr string bstr)
{
/*
unsigned int asize= astr.size()
bsize= bstr.size();
int counter[asize+1][bsize+1];
for(i= 1; i<= asize; i++)
counter[i][0]= 0;
for(i= 0; i<= bsize; i++)
counter[0][i]= 0;
for(i= 1; i<= asize; i++)
for(j= 1; j<= bsize; j++)
if( astr[i-1] == bstr[j-1] )
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 835 2008-07-24 21:21 trunk\a.txt
文件 15546 2008-07-24 22:28 trunk\cpd.cpp
文件 3292 2008-07-24 21:49 trunk\cpd.h
文件 158813 2008-07-24 22:28 trunk\cpd.o
文件 734 2008-07-24 20:52 trunk\main.cpp
文件 121933 2008-07-24 20:52 trunk\main.o
文件 945 2008-07-24 22:28 trunk\Makefile.win
文件 1567 2008-07-24 20:48 trunk\my.txt
文件 1084 2008-07-24 21:11 trunk\mysecond.txt
文件 827 2008-07-24 21:21 trunk\Repository\a
文件 22 2008-07-24 21:21 trunk\Repository\filelist.lst
文件 21631 2008-07-24 21:21 trunk\Repository\hstb.txt
文件 1551 2008-07-24 20:53 trunk\Repository\my
文件 1076 2008-07-24 21:11 trunk\Repository\mysecond
文件 827 2008-07-25 15:36 trunk\Repository\t.tmp
文件 1058 2008-07-24 19:48 trunk\trunk.dev
文件 650575 2008-07-24 22:28 trunk\trunk.exe
目录 0 2008-07-24 21:21 trunk\Repository
目录 0 2008-07-24 22:28 trunk
----------- --------- ---------- ----- ----
982316 19
相关资源
- C++中头文件与源文件的作用详解
- C++多线程网络编程Socket
- VC++ 多线程文件读写操作
- 利用C++哈希表的方法实现电话号码查
- 移木块游戏,可以自编自玩,vc6.0编写
- C++纯文字DOS超小RPG游戏
- VC++MFC小游戏实例教程(实例)+MFC类库
- 连铸温度场计算程序(C++)
- 6自由度机器人运动学正反解C++程序
- Em算法(使用C++编写)
- libstdc++-4.4.7-4.el6.i686.rpm
- VC++实现CMD命令执行与获得返回信息
- 白话C++(全)
- C++标准库第1、2
- 大数类c++大数类
- C++语言编写串口调试助手
- c++素数筛选法
- C++ mqtt 用法
- 商品库存管理系统 C++ MFC
- c++ 多功能计算器
- C++17 In Detail
- 嵌入式QtC++编程课件
- 颜色识别形状识别STM103嵌入式代码
- c++ 邮件多附件群发
- c++ 透明代理(hookproxy)
- mfc 调用redis
- FTP客户端源码(c++)
- c++ 画图(14Qt-XPS)
- c++多边形交并差运算
- VC++基于OpenGL模拟的一个3维空间模型
评论
共有 条评论