How can i splice a string line taken from a text file

For a school project I had to get input from a text file, insert words inside specific parts of the line and standard output it without changing the file. for this i came up did:

1
2
3
4
5
6
7
  while(file>>word)
{
vector.push_back(word)
//do something with the vector elements
//loop trough vector
cout<<vector+" ";
}


when i did that i was getting the getting most of the results i wanted but, my code wasn't taking into account the new line character and the whole output was one entire string line instead of separate lines. I figured I could use getline() to get all the lines seperately, but how can a separate all the words int the line into different strings.
Topic archived. No new replies allowed.