getline ignores the first chunk of text

I'm not really sure how to describe whats going wrong. But if you run it and see the result youll understand. It is a program to "encrypt" a message. you turn the letters to ASCII equivalent and multiply it and add to it. Then you have a message in the form of arbitrary numbers. But if i write a 14 word sentence i get a 11 word encrypted message.
I appreciate the help

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
   #include <iostream>
using namespace std;





int main()
{
    string Text;
    int Mult, Add, Num;


        cout<<"What is your multiplier?"<<endl;
        cin>>Mult;
        cout<<"What is your adder?"<<endl;
        cin>>Add;
        cout<<"Enter in a sentence you want encrypted"<<endl;
        cin>>Text;
        cin.ignore();
        getline(cin, Text);


            cout<<"Encrypted: "<<endl;
            for(int i=0; i<Text.length();i++)
            {
                Num=Text[i];
                Num*=Mult;
                Num+=Add;

                cout<<" "<<Num;
            }

return(0);

}
1
2
3
cin>>Text; //Read first word
cin.ignore(); //Skip one character
getline(cin, Text); //Read the rest of the line 
What are you trying to do here?
delete line19 is OK
Have a try
Topic archived. No new replies allowed.