Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can anyone write code for me?C++ in Visual Studio 2013 The project is due in one

ID: 3679196 • Letter: C

Question

Can anyone write code for me?C++ in Visual Studio 2013

The project is due in one week. Specifically, it is due by the midnight on the day of the next lab.

Implement the lab using procedural programming techniques only. That is, you are not allowed to define classes or objects.

Diff. Implement a program that compares two text files character-by-character. The program should output the line numbers that contain different characters and the place where the two lines start to differ (the difference is denoted by ^ (caret) character. If both files are identical, the program should output nothing. If one file is shorter than the other, the shorter file is assumed to have empty lines, i.e. the extra lines of the longer file are considered different from the empty lines of the shorter file.

The file names should be passed as arguments on the command line. Assume the two file names are the same length. Assume the files exist. If your program is invoked with different number of arguments, print help message and quit. The program operation should look like this:

where 20 and 25 are line numbers.

You are allowed to use getline() and string comparison functions in the implementation of this project.

Hint. The command line arguments are input as C-style strings arguments to main(). See this program for an example of handling them.

To configure command-line arguments for an MS Visual Studio project, right-click Solution Explorer, select "properties" from the drop-down menu, go to Configuration Properties Debugging and set "Command Arguments" in the properties list.

To create a string of spaces of a particular length use this form of initialization: string spaceString(length, ' ');, or use assign operator: spaceString.assign(length, ' ');

Example:

Explanation / Answer

#include "stdafx.h"

#include <windows.h>

#include <iostream>

using namespace std;

class Compare

{

private:

HANDLE hfile1,hfile2;

char * buffer;

char * bufferF2;

public:

BOOL rTestF1,rTestF2;

DWORD readcF1,readcF2;

Compare()

{

buffer=NULL,bufferF2=NULL;

buffer=new char[1024];

bufferF2=new char[1024];

rTestF1=true;

rTestF2=true;

readcF1=1;

readcF2=1;

}

~Compare()

{

//cout << "Object Destroyed. " << endl;

delete [] buffer;

delete [] bufferF2;

CloseHandle(hfile1);

CloseHandle(hfile2);

}

int Open(char * arg1,char* arg2)

{

hfile1=CreateFileA(arg1,GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);

hfile2=CreateFileA(arg2,GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);

if(hfile1==INVALID_HANDLE_VALUE || hfile2==INVALID_HANDLE_VALUE)

{

cout << "Error code " << GetLastError() << endl;

return 1;

}

else

return 0;

}

private:

int Read()

{

rTestF1=ReadFile(hfile1,buffer,1024,&readcF1,0);

rTestF2=ReadFile(hfile2,bufferF2,1024,&readcF2,0);

if(rTestF1==0 || rTestF2==0 )

{

cout << "Error code " << GetLastError() << endl;

return 1;
}

else

{

return 0;

}

}

public:

int Cmp()

{

while(Read()==0 && readcF1!=0 && readcF2!=0)

{

for(unsigned long a=0;a<readcF1;a++)

{

if(buffer[a]!=bufferF2[a])

{

cout << "Files are not equal! ";

//~Compare();

return 1;

}

}

}

cout << "Files are equal. ";

return 0;

}

};

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote