Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <string>
- #include <cctype>
- char toupper_and_tolower(char c)
- {
- if (std::isupper(c)) {
- c = (char)std::tolower(c);
- }
- else if (std::islower(c)) {
- c = (char)std::toupper(c);
- }
- return c;
- }
- int main()
- {
- std::string s = "Yahoo Google";
- std::string d;
- d.resize(s.size());
- std::transform(s.begin(), s.end(), d.begin(), toupper_and_tolower);
- std::cout << s << std::endl;
- std::cout << d << std::endl;
- }
Advertisement
Advertisement
Advertisement
RAW Paste Data
Copied
Advertisement