At the end of the program I output the contents of a vector, the strings were inputted from a text file. The entire vector is outputted, but how do I just output one word? I am asking this because I will later need to modify each string.
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){ 
  ifstream in;
  string line, file_name;
  vector <string> phrase;
  int total_words, total_letters, total_chars;
  cout << "PIG LATIN PROGRAM" << endl; 
  cout << "Which file are you accessing? : ";
  cin >> file_name;
  in.open(file_name);
  if (in.fail()) cout << "\nFile not found!" << endl;
  while(getline(in, line)) phrase.push_back(line);
    for(int i = 0; i < phrase.size(); i++){
    int limit = phrase.size() - 1;
    while(i < limit &&  phrase[i] == phrase[i]){
        i++;
    }
       cout << phrase[i];
}   
 
     
     
    