What I'm trying to do is create a vector that will hold a message. So by using cin I am trying to store numerous characters into my vector without any limits. What I can't seem to do is store the information from the cin into the vector continuously. What I need to have is to be able to type - without interruption - and then for that text to be stored in the vector.
I was going to that, but I want to be able to access the string and be able to rearrange the items. Is it possible to convert a string into an array of char?
vector<string>words;
string temp=" ";
while(cin>>temp)//temp are the words that go into the vector words, each being a vector element
words.push_back(temp)//keep typing/adding words
if(temp=="no_more")break;//stop further input
sort(words.begin(),words.end())//sort the words in the vector from lowest to highest value
for(int i=0;i<words.size()-1;++i)//print the words - one to a line.
cout<<words[i]<<endl;
Have you seen this yet? If not, read it. You can do all kinds of things with the string class. The string is a class that encapsulates an array of characters. You can use its member functions to manipulate the data or get random access iterators to the characters. You can also pass the iterators to std algorithm methods such as std::count, std::find, std::reverse, etc. http://cplusplus.com/reference/string/string/