Advertisement
Guest User

Untitled

a guest
Jan 14th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. void changeCase(string &s)
  7. {
  8. for (int i = 0; i < s.length(); i++)
  9. {
  10. if (s[i] >= 'a' && s[i] <= 'z')
  11. {
  12. s[i] = (s[i] - 'a' + 'A');
  13. }
  14. else if (s[i] >= 'A' && s[i] <= 'Z')
  15. {
  16. s[i] = (s[i] - 'A' + 'a');
  17. }
  18. }
  19. }
  20.  
  21. int main()
  22. {
  23. string s;
  24. cin >> s;
  25. changeCase(s);
  26. cout << s;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement