string.find(" ") is not finding spaces

c++, string

Solution

You're not reading the space (`cin >> inputString` stops on whitespace...).

Use `std::getline(std::cin, inputString)` instead.

Problem

I'm trying to find space in a string that a user inputs. I want to use `find()` from `std::string` to return the position of the space. If the input is "Seattle, WA USA", and I want `find(" ", 0)` to return `8`, how would I do this? 8th is the space after "," ``` string inputString = " "; cout << "Enter String to modify" << endl; cin >> inputString; int spac = inputString.find(" " , 0); ``` But `find()` is keep returning `0`. I am not sure why.

Original source