MeehoweCK

Untitled

Mar 7th, 2023
676
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void convertCase(string &text)
  6. {
  7.     unsigned d = text.size();
  8.  
  9.     cout << &text << endl;
  10.  
  11.     for(unsigned i = 0; i < d; ++i)
  12.     {
  13.         if(text[i] >= 'A' && text[i] <= 'Z')
  14.             text[i] += 32;
  15.         else if(text[i] >= 'a' && text[i] <= 'z')
  16.             text[i] -= 32;
  17.     }
  18. }
  19.  
  20. int main()
  21. {
  22.     string tekst = "Ala ma Kota";
  23.  
  24.     cout << &tekst << endl;
  25.     cout << tekst << endl;
  26.  
  27.     convertCase(tekst);
  28.  
  29.     cout << tekst << endl;
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment