Inline Code Example HereCan 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>


Here is a rudimentary way to accomplish this:<o:p></o:p>

  1. Create two temporary char arrays to hold words being read from files.<o:p></o:p>

  2. Create two fstream (or ifstream) objects to open both files simultaneously and read them in.<o:p></o:p>

  3. In a loop, read a word from both files using >> operator. Loop should terminate if any file ends.<o:p></o:p>

  4. 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>

  5. Display total number of matches as a percentage of total words read from the smallest file.<o:p></o:p>

3 Years
Discussion Span
Last Post by aroojasif22

We won't do your homework for you. How far have you got? Have you got this far yet?

int main()


What are you stuck on, or what do you not understand?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.