LearnFrenzy
Sign in Take a free test

Input/Output with cin and cout · Input/Output MCQ · Question 14

cin.get(c) vs cin >> c for a char Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 14 Back to Exercise

What is the difference between std::cin.get(c) and std::cin >> c for a char c?

  • A None
  • B get(c) reads the next character even if it is whitespace; >> skips whitespace first Correct
  • C get(c) reads a whole word
  • D >> reads only digits
Correct Answer: Option B

Use get when spaces and newlines matter, e.g. counting characters or reading a text verbatim.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links