I have tried to make basic string encryption, by swapping two consecutive letters. And it didn't really work as I intended.
#include <iostream>
#include <string.h>
#include <algorithm>
int main() 
{
    std::string str = "This is a simple string.";
    for (int i = 0; i <= str.length(); i++) {
        std::swap(str[i], str[i + 1]);
    }
    std::cout << str;
    std::cin.get();
}
I want to actually swap two near letters, so it will look like encrypted. The Current result is
his is a simple string.
 
     
    