Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int i, x, n;
- char str[100];
- char str2[100];
- cout << "tell me why you got something to hide:\t";
- cin >> str;
- cout<< "tell me why you got the key here: ";
- cin>>n;
- cout << "\nchoose wise:\n";
- cout << "1 = zaszyfrowanie.\n";
- cout << "2 = odszyfrowanie.\n";
- cin >> x;
- switch(x)
- {
- case 1:
- for(i = 0; (i < 100 && str[i] != '\0'); i++)
- str[i] = str[i] + n;
- cout << "\nZaszyfrowanie: " << str << endl;
- break;
- case 2:
- for(i = 0; (i < 100 && str[i] != '\0'); i++)
- str[i] = str[i] - n;
- cout << "\nOdszyfrowanie: " << str << endl;
- break;
- default:
- cout << "\nZle dane !!!\n";
- }
- return x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement