Hello,

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

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.

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 ?

Are you showing us the part of your code that works?
Because I don't see any problems.

you entered nothing followed by the return key signaling a new line meaning an empty string was placed in w1, it then went on to capture the next line where you entered in word1 and word2 which it stored in w2

I am not understanding what problem you are having. What output were you expecting to get?

i send you the code because is big to post it here

I'm sorry but I am not going to download anything I do not know the contents of (especially from rapidshare). Please post the relevant parts here and maybe someone can help you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.