question about getline

Hello,

I am writing a program that accepts 2 strings as input (they may or may not have spaces), then take the characters one by one from each string in order, and find their score in a matrix. Space must not be ignored. It is considered a character in this program.

I only need to know how to use getline twice in a row to allow spaces without adding or ignoring any spaces to/from the beginning/end of the strings.

std::cin does not work for spaces, but I am unable to enter the first string if I use getline.

Thanks in advance.
Last edited on
closed account (48T7M4Gy)
Insert cin.ignore;() line directly after the last cin << ... ; before any getline() statement.
Last edited on
Thanks Kemort....

It worked, but I decided to take a different rout forcing the user to use "-" for every space. This way spaces are more noticeable and are easy to count on the screen.
Topic archived. No new replies allowed.