반응형
<코드>
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
using namespace std;
string s;
int main()
{
while (1)
{
getline(cin ,s);
if (s == "") break;
cout << s << endl;
}
}
풀이 방법
문자열을 한번에 저장하는 string 자료형을 이용하여 한줄 입력을 받을 수 있는 getline함수를 사용합니다.
반응형
'🧩PS > 🥈Nomal' 카테고리의 다른 글
[C/C++] 백준 2110번 - 공유기 설치 (0) | 2020.12.22 |
---|---|
[C/C++] 백준 11719번 - 그대로 출력하기2 (0) | 2020.12.20 |
[C/C++] 백준 1264번 - 모음의 개수 (0) | 2020.12.20 |
[C/C++] 백준 9872번 -Record Keeping (0) | 2020.12.20 |
[C/C++] 백준 20291번 - 파일 정리 (0) | 2020.12.19 |