I am using getline()to get bunch of strings and push them into the vector. I don't why but when i type words.size() it always says 2 but there are more than two elements in the vector.
I may be wrong, but Is it true that the element of this vector<string>user_input will always be equal to 1 because the getline() appends these elements into the strings so the vector always has just 1 big string?
My Goal: I want to be able to manipulate with lines of a paragraph and add endl; at the end of every line with a certain character restriction in every line.
Seems to be slightly mixed up there.
The code has a vector called words and a string called userInput. It doesn't have anything called user_Input.
The elements of vector<string> words will each be a string. getline() replaces the previous contents of the string. push_back() adds a new element to the vector.
Let's look at an example. Here I'm using a stringsteam called input for convenience. You could replace input with cin at line 22.