Explanation cin

Can you guys explain what the difference is ? Thanks

 
  std::getline(std::cin, input);


 
  std::cin >> input;
getline reads from the input buffer till it encounters a newline character(by default, can be changed).
cin on the other hand reads input till a whitespace character is met.
Oh ok thanks mate
Remember cin >> first ignores leading whitespace, but getline does not.
Also, std::getline() is better for strings.
Topic archived. No new replies allowed.