I'm working on right now with string
in vector
. And i got my self in dead end . I've manipulate with vector<int>
elements, and understand how to work with them ! I know how to work with string
! But i can't get thru the part where i need to change string element value in vector .I mean i don't know what to do in loop
with "do something". So to be short i give the task on witch i work right now.
Read a sequence of words from cin
and store values in vector
.After you've read all words,process the vector
and change each word to uppercase
Here what I've got so far
int main ()
{
vector<string> words; //Container for all input word
string inp; //inp variable will process all input
while (cin>>inp) //read
words.push_back(inp); //Storing words
//Processing vector to make all word Uppercase
for (int i = 0; i <words.size(); ++i)
//do something
words[i]=toupper(i);
for (auto &e : words) //for each element in vector
//do something
cout<<e;
keep_window_open("~");
return 0;
}
This first for
statement is not right i try access vector
elements and change words to upper but it did't work for me its just sample
I've try many ways to access the vector
element but when trying to use string
member functions toupper()
on vector
i'm getting messy with code and logical mistakes!
Thanks For your time .
Sorry for mistakes i made in spelling words