Thread: A Problem
View Single Post
Old 20-03-2005, 07:11 PM   #3
Jim6
Abandonia nerd

 
Join Date: Mar 2005
Location: ,
Posts: 77
Send a message via AIM to Jim6 Send a message via Yahoo to Jim6
Default

Here ya go - it's quick and nasty though!


#include <iostream>
#include <fstream>
using namespace std;

int main() {
string filename1,filename2;
cout<<"File one: ";
cin>>filename1;
ifstream inone(filename1.c_str());
cout<<"File two: ";
cin>>filename2;
ifstream intwo(filename2.c_str());
string a,b;
int n = 0;
while ((!inone.eof()) && (!intwo.eof())) {
getline(inone,a);
getline(intwo,B);
n++;
if (a != B) {
cout<<"There was a discongruity on line: "<<n<<"\n";
}
}
return 0;
}

Edit: Ugh... lost all my formatting...
Edit2: Ugh... it turned my code into smileys!
Jim6 is offline                         Send a private message to Jim6
Reply With Quote