encrypt and decrypt a string

looking for C++ source to solve the above problem for an assignment
Last edited on
what?
I understand this is an exercise so you should not expect anyone to do all the work for you. If you have minor, more specific question we might be able to help.
Here, this code will give you a hand:

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <string>
using namespace std;

int main()
{
    string output = "Hand";

    cout << "Heres your hand: " << output << endl;
    cout << "And heres a pointer on how to do it right: " << &output << endl;

    return 0;
}


</troll>

What type of encryption algorithm do you want to use? You could go with some simple XOR and Caesar Shifts. Here's an article on XOR: http://cplusplus.com/articles/Ly86b7Xj/
#include <iostream>
#include <string>
using namespace std;

int main()
{
string password = "22";

cout << "Heres your 22: " << password << end;
cout << "And heres a pointer on how to do it right: " << Password& << endl;

system("pause");
return 0;
}






this is code for encryption what changes in code for decryption can i make
Last edited on
this is code for encryption what changes in code for decryption can i make
How is that encryption code?

You literally copied ModShop's code and changed a couple of variable names and assignments.

ModShop, you missed out the #include<sarcasm> header there.
Last edited on
iHutch105 wrote:
ModShop, you missed out the #include<sarcasm> header there.


Ha. I intentionally left that out to make it educational for him, to see if he could solve the error.

@jpatryan: If you want help, ask specific questions. Examples are: "What are some easy to implement encryption algorithms?", "How do I implement X algorithm?", "I tried to do X, but Y happened. What did I do wrong?". Asking people to do your entire assignment will get you nowhere.
Topic archived. No new replies allowed.