Vart you did help- but I am having trouble still with it not comparing the strings. I have been working on this forever- and i just dont understand where i am going wrong. Here it is- please someone help!
Code:
void countnames(string list [], int& count, ifstream& inputfile, ofstream& outputfile)
{
int flag;
string temp;
count = 0;
inputfile >> temp;
while(!inputfile.eof())
{
if(count <= MAX)
{
temp = fixname(temp);
isnamefound(list, temp);
if (isnamefound(list,temp))
{
list[count] = temp;
count++;
}
else
{
inputfile >> temp;
}
}
inputfile >> temp;
}
outputfile << "# of unique names: " << count << endl;
}
bool isnamefound(string list[], string temp)
{
bool flag;
for (int i =0; i < MAX; i++)
if (temp != list[i])
{
flag = 0;
}
else
{
flag = 1;
}
if (flag ==0)
return true;
else
return false;
}
one of my TA's told me to do the flag thing- but its giving me the same output as i had before.