Ok so I am currently working on a program that encrypts or decrypts text that is typed in by the user. I am currently having a problem with my program encrypting and decrypting more than one word in a sentence. For example, whenever I try to encrypt the sentence (Life is Good), the program will only encrypt Life. Can anybody here take a look at my code and help me. I would greatly appreciate it.
#include <iostream>
#include <cstring>
using namespace std;
int main ()
{
char text[10];
static const char encrypt[] = "encrypt";
static const char decrypt[] = "decrypt";
int shift;
char cipher[25];
int result1;
int result2;
int num;
yeah, I had exactly the same issue when I programmed a simple XOR-Encryption,
the problem is actually, that the "cin >>" operator automatically stops when it encounters a space by design, so that you can input several variables, seperated by spaces like this: cin >> x >> y >>z;.
There's actually a forum post about it. cire already posted the answer,I just wanted to comment on this :D
Please mark this Question as solved, Reclaimer. ..