C++ program to read string using cin.getline()
Since cin does not read complete string using spaces, stings terminates as you input space. While cin.getline() – is used to read unformatted string (set of characters) from the standard input device (keyboard). This function reads complete string until a give delimiter or null match.
In this program will read details name, address, about of a person and print in different lines, name will contain spaces and dot, address will contain space, commas, and other special characters, same about will also contains mixed characters. We will read all details using cin.getline() function and print using cout.