Inline Code Example Here
Can anyone please give me the code for copy detection.
OBJECTIVE: A program that detects copied codes.<o:p></o:p>
Sometimes students tend to submit copied assignments and detecting copy cases manually can be very time-consuming. You are going to write a simple software that compares two files word-by-word and output the number of matched words as a percentage.<o:p></o:p>
Your code file name must be projq2.cpp<o:p></o:p>
Input: Any two .cpp files. File names can be built into the code or can be provided as command line arguments (show syntax of using your program in this case in comments within the file).<o:p></o:p>
Output: Console / screen.<o:p></o:p>
Processing:<o:p></o:p>
Here is a rudimentary way to accomplish this:<o:p></o:p>
Create two temporary char arrays to hold words being read from files.<o:p></o:p>
Create two fstream (or ifstream) objects to open both files simultaneously and read them in.<o:p></o:p>
In a loop, read a word from both files using >> operator. Loop should terminate if any file ends.<o:p></o:p>
Words read from both files are compared to see whether they exactly match each other or not. Keep a count of number of matches.<o:p></o:p>
Display total number of matches as a percentage of total words read from the smallest file.<o:p></o:p>