Created
May 19, 2015 15:23
-
-
Save krysseltillada/b48a2c37eb653fe17083 to your computer and use it in GitHub Desktop.
uppercasing vector of strings using iterators
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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