My Code isn't compiling, can anyone help me figure out where i went wrong

#include <iostream>
#include <cstdlib>
#include <fstream>

using namespace std;

int main( )
{
ifstream inFile1;
ifstream inFile2;
ofstream outFile1;
int mClientNumber, fClientNumber;
string mClientName, fClientName;
bool atLeastOneFileNotAtEnd = true;
bool inFile1Written = false;
bool inFile2Written = false;


cout << "File merge processing starting" << endl;
inFile1.open("MaleClients.rtf");
inFile2.open("FemaleClients.rtf");
outFile1.open("MergedClients.rtf");
inFile1 >> mClientNumber;
inFile1 >> mClientName;
inFile2 >> fClientNumber;
inFile2 >> fClientName;
while ( atLeastOneFileNotAtEnd == true )
{
if(inFile1.eof())
{
if(inFile2Written == false)
{
outFile1 << fClientNumber << " ";
outFile1 << fClientName << endl;

inFile2Written = true;
}
}
else if (inFile2.eof())
{
if (inFile1Written == false)
{
outFile1 << mClientNumber << " ";
outFile1 << mClientName << endl;
inFile1Written = true;
}
}
else if (mClientNumber < fClientNumber)
{
outFile1 << mClientNumber << " ";
outFile1 << mClientName << endl;
inFile1Written = true;
}
else
{
outFile1 << fClientNumber << " ";
outFile1 << fClientName <<endl;
inFile2Written = true;
}
if(!(inFile1.eof()) && (inFile1Written == true))
{
inFile1 >> mClientNumber;
inFile1 >> mClientName;
inFile1Written = false;
}
if(!(inFile2.eof()) && (inFile2Written == true))
{
inFile2 >> fClientNumber;
inFile2 >> fClientName;
inFile2Written = false;
}
if (inFile1.eof()&& inFile2.eof())
{
atLeastOneFileNotAtEnd = false;
}
}
inFile1.close();
inFile2.close();
outFile1.close();
cout << "Merging Complete" << endl;

system("PAUSE");
return 0;
}
you cannot do

 
inFile2 >> fClientName;


you can use the >> operator on a stringstream and get the string from it.

1
2
3
std::stringstream fClientName;
inFile2 >> fClientName;
fClientName.str();
Topic archived. No new replies allowed.