본문 바로가기

C++문법

getline()

<입력> 

So when I die (the [first] I will see in (heaven) is a score list). 
[ first in ] ( first out ). 
Half Moon tonight (At least it is better than no Moon at all].
A rope may form )( a trail in a maze.
Help( I[m being held prisoner in a fortune cookie factory)].
([ (([( [ ] ) ( ) (( ))] )) ]).
 .
.


enter 전 1행을 공백까지 전체 입력받고 싶을 때 getline(cin, s); 

(s는 string s;)

 

*2021.09.22 내용 추가

cin.ignore(); //엔터 후 cin에 남은 버퍼 제거