Hi, i'm a newbie, and i have a trouble with a program.
The program doesn't work as i desire. This is a little fragment of my program:

//Requesting data from users.
            cout<<"\n\nEnter your last name:\n\t";
            cout<<"\nEnter your mother's maiden last name:\n\t";
            cout<<"\nEnter your first name:\n\t";

When i run the program, it skips the first getline() statement, but runs the other statements perfectly, doing something like that:

Enter your last name:
<--This line is skipped
Enter your mother's maiden last name:
Enter your first name:

Please, help me with this!!!

P.S.: I'm sorry if you can't understand me well, but i speak a little english.

Do you have a line like cin >> somevariable; up above that point? There's probably a stray newline left in the stream from where you pressed enter during the cin operation.

int i;
string str;
cin >> i; //enter in 10 + <enter>, 10 goes into i
getline(cin,str); //getline picks up enter ('\n') and thinks input is complete

See the sticky thread in this forum about flushing the input buffer. But, if it's just that one stray '\n' putting in a cin.ignore(); before your getline statement should do the trick.

check your original program,sometimes other syntax errors produce no errors but they r masked by your other errors ;)
anyway check header file?
declared that string?

Hey try getting the input name using cin only like


see whether this works and then proceed

anyway check header file?
declared that string?

What would any of those have to do with the "skipping over" of the getline at runtime?