fork(2) download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <map>
  4. #include <cctype>
  5. #include <string>
  6.  
  7. const std::map<char, char> m = {
  8. {'a', '*'}, {'e', '$'}, {'i', '/'}, {'o', '+'}, {'u', '-'}
  9. };
  10.  
  11. int main()
  12. {
  13. std::cout << "Enter Message here:\n";
  14. std::string s;
  15. getline(std::cin, s);
  16.  
  17. std::for_each(s.begin(), s.end(), [](char& c) {
  18. auto i = m.find(std::tolower(c));
  19. if(i != m.end())
  20. c = i->second;
  21. });
  22.  
  23. std::cout << "Encrypted Message: " << s << '\n';
  24. }
  25.  
Success #stdin #stdout 0s 3068KB
stdin
Meet me now
stdout
Enter Message here:
Encrypted Message: M$$t m$ n+w