The above code you have for original >> extracting words from your text file will only work 'word at a time', until it hits a white space.
Therefore, a word like "10 Speeds" will be put into two separate str[] objects.
One way to get around this, is to use the getline() function. This would work good for your file anyway, because individual words are contained on their own line.
//instead of
original >> str[i];
//try this:
getline(original, str[i]);
You mentioned that, "some words get doubled." It may be because you are testing for eof() in your loop, which would necessitate an extra loop interation before the eof() flag is set to TRUE. Instead, just test the return value of getline(), which will return TRUE if the extraction was successful, else will return FALSE if extraction unsucessful (which would occur at end of file):
//insted of this
while(!original.eof())
//try this:
while(getline(original, str[i]))
Also here, I notice you are trying to use the < operator on two string objects. While this is fine whilst performing boolean logic among individual characters of the string, I do not see anywhere in the <string> class documentation where the < is overloaded to make comparisons between strings. However, I will make a suggestion to help get you pointed in the right direction:
//str[i] resovles to a single string
if(str[i]>str[i+1])
//need to go one step futher to get to individual characters of the string
if(str[i][j]>str[i+1][j])
Since we are at …