Basically, I guess I dont understand why you would need an array when you can just do everything individually which makes it less complicated. I understand the concept of the array and how it holds variables or names of the same datatype but I dont know understand how to implement it into my program. We have to read from a file that the user inputs using filestreams (got that)...then we have to read each name in the file and create an array to store each name only once. We then have to fix the names in the string to have the first letter capitalized an the rest lower case (got that)...then we have to count the number of names (not repeated names) etc. Here is my code. Ok basically all it is doing right now is taking the names one by one and going into fixname and fixing them and putting them in my output file. I am guessing I have to put all of the names in an array- and then fix them all at once or something?? See I just dont understand. i have a code for an array I guess...but its not working (or i really dont know what it is supposed to do).

Here is my code:

Code:
 inputfile >> name;
   while(!inputfile.eof())
    {
      // countnames(names,size,inputfile);
      fixname(name);
      outputfile << name << endl;
    inputfile >> name;
    }

   return 0;
}

string fixname(string& name)
{
  if (name[0] >= 'a' && name[0] <= 'z')
    {
      name[0] = toupper(name[0]);
    }
  for (int i = 1; i < name.length(); i++)
    {
      name[i] = tolower(name [i]);
    }
  return name;
}

void countnames(string names[MAX], int& size,ifstream& inputfile)
{
  for (size = 0; size < MAX; size++)
    inputfile >> names[size];
}