Hello,

In some functions of my program this code doesn`t work normally

Code:
        string w1;
        string w2;

        cout<<"1st msg: Enter 2 words: ";
        getline(cin,w1);
        cout<<endl;

        cout<<"2nd msg: Enter 2 words: ";
        getline(cin,w2);
        cout<<endl;

        cout<<endl<<"w1: "<<w1<<endl;
        cout<<"w2: "<<w2<<endl<<endl;
But when i run it is some functions(except main and some others) of my program shows other output.
Code:
1st msg: Enter 2 words:
2nd msg: Enter 2 words: word1 word2


w1:
w2: word1 word2
My variables are again local, any ideas whats the problem ?