help need for writing an algorthim for a program that reads to file and compares them

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hapa
    New Member
    • Oct 2006
    • 31

    help need for writing an algorthim for a program that reads to file and compares them

    I am suppose to write a C++ program that reads two C++ program and compares both of them and outputs wether they are copied or not.
    But the problem is i dont know where to start from that is i have no lead on the algorthim
    one possible solution that came to my mind is that first i will have to use while END of file loop
    and read each character one by one from the two program and compare them

    however the problem would be for instance
    suppose
    first file has this line in it
    int y = 1;

    second file has this line in it

    int number = 1;

    since both these line mean the same thing how can i use compare them using char only since the variable "y" is not equal to "number"
    but the value stored in them is the same

    wut can i use here and is their an alternative to use other than char if so please advise

    and how should i start making up an algorithm
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Is this an exercise for your course or a real problem. If it is an exercise check back with your teacher/professor and find out what things it is and isn't required to detect.

    Sounds to me like you have an incomplete specification for the program.

    Comment

    Working...