#include <iostream > void encrypt( char [ ] ); void decrypt( char * ePtr ); int main( ) { char vaihto [50]; char vastaus; std::cout << "do you wanna crypt or decrypt?\n c/d" << std::endl; std::cin >> vastaus; if (vastaus == 'k') { std::cout << "write text you would like to encrypt" << std::endl; std::cin.get(vaihto, 49); std::cout << "you wrote: " << vaihto << std::endl; encrypt( vaihto ); std::cout << "encrypted: " << vaihto << std::endl; system("pause"); return 0; } else if (vastaus == 'd') { std::cout << "write the string you would like to decrypt" << std::endl; std::cin.get(vaihto, 49); decrypt( vaihto ); std::cout << "Decrypted string is: " << vaihto << std::endl; system("pause"); return 0; } else std::cout << "answer properly!" << std::endl; system("pause"); } void encrypt (char e[] ) { for( int i=0; e[i] != '\0'; ++i ) ++e[i]; } void decrypt( char * ePtr ) { for( ; * ePtr != '\0'; ++ ePtr ) --(* ePtr); }
Announcement
Collapse
No announcement yet.
Need help (again)
Collapse
X
-
Need help (again)
Hello, im making siiimple C++ encryption / decryption program. here's the code:
Code:ok baiTags: None
Comment