I use getline(cin, variable) to read an entire line including spaces: string fullName; getline(cin, fullName); reads everything until Enter. If they type Alice Marie Smith, that is the full result.
Unlike cin >>, getline does not skip leading whitespace and does not stop at spaces. It reads until a newline character, then removes that newline and stores everything else. The function call uses getline(cin, fullName), not cin.getline(fullName).
After reading, the newline is consumed and removed from the buffer, leaving it clean for the next read.