dear all,
I have done a simple c++ program in witch I compared two same files but one file contains the text with no error and other file contains spelling error in it. I print their differences in another file.....
Now i want the same thing in Microsoft access using the following code. I really don;t know how to connect this code with MS access
Please please please help me step by step to complete this assignment before 18,December 2012.
Here is code that i am using to check the differences between two files.
Code:
//checks the Difference between two files
#include <iostream.h>
#include <conio.h>
#include <string.h>
#include <fstream.h>
int main()
{
char str_1[36];
char str_2[36];
char ch_1, ch_2;
int i=0;
clrscr();
ifstream file_1 ,file_2;
ofstream file_3;
file_1.open("file_1.txt", ios::in);
file_2.open("file_2.txt", ios::in);
file_3.open("file_3.txt", ios::out);
//The difference will be shown in these Parentheses
file_3 << "\t\t\"{}\": Change Text\n";
file_3<< "\t\t\"[]\": Original Text\n\n";
//go to the end of the file
while(!file_1.eof())
{
file_1.getline(str_1,35);
file_2.getline(str_2, 35);
ch_1 = str_1[i];
ch_2 = str_2[i];
// If the line of file2 ends but the line of file1 is not ended then print the renaming character in file3
if(file_2.eof() && !file_1.eof())
{
while(!file_1.eof())
{
file_3 << str_1<<"\n";
file_1.getline(str_1,35);
}
cout<<"\n\n\n\n \t\t........Comparison has been completed....... :)\n\n\n\n Open file_3 to check the changes.. THANK YOU :P";
getch();
return 0;
}
// If both the lines are equal then simply checks their differences
while(ch_1 != '\0')
{
if(ch_1 == ch_2)
file_3 << ch_1;
else
{
file_3 << "{" << ch_1 << "}" << "[" << ch_2 << "]" ;
}
ch_1 = str_1[++i];
ch_2 = str_2[i];
}
file_3 <<"\n \n ";
i=0;
}
// If the line of file1 ends but the line of file2 is not ended then print the renaming character in file3
while(!file_2.eof())
{
file_3 << str_2 << "\n";
file_2.getline(str_2 , 35);
}
file_2.close();
file_1.close();
file_3.close();
cout<<"\n\n\n\n \t\t........Comparison has been completed....... :)\n\n\n\n Open file_3 to check the changes.. THANK YOU :P";
getch();
return 0;
}
.
Regards.
Mustanser Iqbal