- for loop int i = 0 etc but subsequent code doesn't mention index i, meaning the program will read just the first line from the text; you need to have a i++ at the end of each loop if you want to read just 10 lines from the file. If you want to read the whole file there is no need for this counter, instead use if(inputFile) or while(inputFile) as required after opening it;
- it appears you are trying to read individual words (identified by the whitespace delimiter) from a given string but note that the interim string, p1string, that you are using to store each word needs to be saved somewhere before you move on to the next word. Otherwise the program will overwrite p1string with the latest word and ultimately it will print out the last word of each line
- so here's a simple program to save a read a string with getline(), split it into individual words and save these words somewhere and print them out to test ...