Advertisement
Guest User

Teaser

a guest
Feb 25th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <vector>
  4. #include <math.h>
  5. #include <bitset>
  6.  
  7. const int START = 65, END = 90;
  8.  
  9. int main()
  10. {
  11.     std::string msg, retMsg;
  12.  
  13.     for (char ch : msg)
  14.     {
  15.         if (((int)ch < START || (int) ch > END) && ch != ' ')
  16.         {
  17.             retMsg += "\n";
  18.             continue;
  19.         }
  20.         else if(ch != ' ')
  21.         {
  22.             char toAdd = (char)END - ((int)ch - START);
  23.             retMsg += toAdd;
  24.         }
  25.         else retMsg += ' ';
  26.     }
  27.  
  28.     std::cout << retMsg << std::endl;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement