Advertisement
AlexandruFilipescu

Convert small letters to big and vice-versa

Jul 16th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.35 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.    
  6.     char S[100];
  7.     int i;
  8.  
  9.     cout << "Introduceti un sir: ";
  10.     cin >> S;
  11.  
  12.     for (i = 0; S[i]; i++) {
  13.         if ((S[i] >= 'a') && (S[i] <= 'z')) { S[i] = S[i] - 'a' + 'A'; }
  14.         else if ((S[i] >= 'A') && (S[i] <= 'Z')) { S[i] = S[i] - 'A' + 'a'; }
  15.     }
  16.  
  17.     cout << S << endl;
  18.  
  19.     cout << 'a' + 'a';
  20.  
  21.     system("pause");
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement