>>How do I organize the input alphabetically?
there are at least two ways I can think of:
1. use a linked list, insert the new name in alphabetical order. The program will have to search all the nodes in the list to find the right spot.
2. similar to #1 above, but use a dynamically expanding array of strings instead of a linked list.
3. Find out how many names are in the file then allocate an array of pointers of that size. Read each string into the array without regard to alphatetizing. After file has been read sort the array using on of many sorting algorithms.
#3 above is the one I would prefer because I think it is the fastest. Not very much searching involved, which can be pretty slow with large arrays.
variable theFile contains the name of a file on disk, it does not contain the information that is in the file. the open function will just open up the file so that the program can read it -- the open function does not actually read the file. To do that you need to either use the stream's extraction operator >> or call its read() function. What is the purpose of all that code after the open() function? It appears to be completly useless.
isalpha() just checks to see if a character is alphabetic -- that is if the character is one of 'a' to 'z' or 'A' to 'Z'. any other character will fail the test.