In C++, reading strings can be tricky when the input contains spaces. For instance, the default cin input method stops reading input when it encounters a whitespace character. In this tutorial, we’ll explore how to handle input with spaces using getline() and cin.getline().1. Problem with cin and SpacesBy default, when you use cin >> variable, it reads input until it encounters a whitespace (spa..