Reading getline from cin into a stringstream (C++)

前端 未结 4 1688
自闭症患者
自闭症患者 2020-12-15 08:52

So I\'m trying to read input like this from the standard input (using cin):

Adam English 85
Charlie Math 76
Erica His

4条回答
  •  醉梦人生
    2020-12-15 09:14

    You can just use cin >> name >> course >> grade; because >> will read until whitespace anyway.

提交回复
热议问题