Yesterday I started developing a encrypting machine, that works like a Caesar cipher. You put a message (e.g., HELLO), choose a key value (e.g., 3) and the result is KHOOR (3 letters forward). 
The problem is that, if I use "cin >> msg;" I can only codify one word. If I use "getline (cin, msg);", the code doesn't work. Maybe it's a simple problem, but I can't solve it... :(
string msg;
int a, b, i, key_value;
char c;
cout << "WRITE YOUR MESSAGE:" << endl;
cin >> msg;                         //HERE IS THE PROBLEM!!!
system ("cls");
cout << "PUT A KEY VALUE:" << endl;
cin >> key_value;
system ("cls");
cout << "THE CODIFIED MESSAGE IS:" << endl;
for (i=0; i < msg.length(); i++) {
    if (msg[i] == 'A') a = 1;
    if (msg[i] == 'B') a = 2;
    if (msg[i] == 'C') a = 3;
    if (msg[i] == 'D') a = 4;
    if (msg[i] == 'E') a = 5;
    if (msg[i] == 'F') a = 6;
    if (msg[i] == 'G') a = 7;
    if (msg[i] == 'H') a = 8;
    if (msg[i] == 'I') a = 9;
    if (msg[i] == 'J') a = 10;
    if (msg[i] == 'K') a = 11;
    if (msg[i] == 'L') a = 12;
    if (msg[i] == 'M') a = 13;
    if (msg[i] == 'N') a = 14;
    if (msg[i] == 'O') a = 15;
    if (msg[i] == 'P') a = 16;
    if (msg[i] == 'Q') a = 17;
    if (msg[i] == 'R') a = 18;
    if (msg[i] == 'S') a = 19;
    if (msg[i] == 'T') a = 20;
    if (msg[i] == 'U') a = 21;
    if (msg[i] == 'V') a = 22;
    if (msg[i] == 'W') a = 23;
    if (msg[i] == 'X') a = 24;
    if (msg[i] == 'Y') a = 25;
    if (msg[i] == 'Z') a = 26;
    b = a + key_value;
    if (b > 26) b -= 26;
    if (b == 1) c = 'A';
    if (b == 2) c = 'B';
    if (b == 3) c = 'C';
    if (b == 4) c = 'D';
    if (b == 5) c = 'E';
    if (b == 6) c = 'F';
    if (b == 7) c = 'G';
    if (b == 8) c = 'H';
    if (b == 9) c = 'I';
    if (b == 10) c = 'J';
    if (b == 11) c = 'K';
    if (b == 12) c = 'L';
    if (b == 13) c = 'M';
    if (b == 14) c = 'N';
    if (b == 15) c = 'O';
    if (b == 16) c = 'P';
    if (b == 17) c = 'Q';
    if (b == 18) c = 'R';
    if (b == 19) c = 'S';
    if (b == 20) c = 'T';
    if (b == 21) c = 'U';
    if (b == 22) c = 'V';
    if (b == 23) c = 'W';
    if (b == 24) c = 'X';
    if (b == 25) c = 'Y';
    if (b == 26) c = 'Z';
    cout << c;
}