Skip to content

Instantly share code, notes, and snippets.

@krysseltillada
Created May 19, 2015 15:23
Show Gist options
  • Save krysseltillada/b48a2c37eb653fe17083 to your computer and use it in GitHub Desktop.
Save krysseltillada/b48a2c37eb653fe17083 to your computer and use it in GitHub Desktop.
uppercasing vector of strings using iterators
#include <iostream>
#include <string>
#include <vector>
int main()
{
std::vector<std::string> vec_str = {"helllllllllllllo"};
for(auto it = vec_str.begin(); it != vec_str.end(); ++it) {
for(auto &c : *it)
c = toupper(c);
}
for(std::vector<std::string>::iterator it1 = vec_str.begin(); it1 != vec_str.end(); ++it1)
std::cout << *it1 << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment