Help with getting full sentence to input

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#include <iostream>
#include <string>
#include <istream>

using namespace std;
void caeser(int shift);
void rev_caeser(int shift);


int main()
{
    int shift;
    int choose;
    cout << "press 1 for encrypting or 2 for decrypting" << endl;
    cin >> choose;
    
    if (choose == 1)
    {
        cout << "how often do you want to shift the letters?" << endl;
        cin >> shift;
        caeser(shift);
    }
    if (choose == 2)
    {
        cout << "how often were the letters shifted?" << endl;
        cin >> shift;
        rev_caeser(shift);
    }
    
}
    
    
void caeser(int shift)
{


    int count = 0, length;
    string input;
    cout << "Enter your phrase: \n";
    cin >> input;
    
    length = (int)input.length();
    
    for (count = 0; count < length; count++)
    {
        if (isalpha(input[count]) || input[count] == ' ')
        {
            input[count] = toupper(input[count]);
            for (int i = 0; i < shift; i++)
            {
                if (input[count] == 'z')
                    input[count] = 'a';
                if (input[count] == ' ')
                    input[count] = ' ';
                else
                    input[count]++;
            }
        }
    }
    cout << input << endl;
}

void rev_caeser(int shift)
{
    
    
    int count = 0, length;
    string input;
    cout << "Enter your phrase: \n";
    cin >> input;
    
    length = (int)input.length();
    
    for (count = 0; count < length; count++)
    {
        if (isalpha(input[count]) || input[count] == ' ')
        {
            input[count] = toupper(input[count]);
            for (int i = shift; i > 0; i--)
            {
                if (input[count] == 'z')
                    input[count] = 'a';
                if (input[count] == ' ')
                    input[count] = ' ';
                else
                    input[count]--;
                
            }
        }
    }
    cout << input << endl;
}


It seems like my program doesnt want to take in a sentence, only the first word i type in, any help appreciated thank you.
closed account (Dy7SLyTq)
getline(cin, input);
Topic archived. No new replies allowed.