입력이 주어진다. 입력은 최대 100줄로 이루어져 있고, 알파벳 소문자, 대문자, 공백, 숫자로만 이루어져 있다. 각 줄은 100글자를 넘지 않으며, 빈 줄은 주어지지 않는다. 또, 각 줄은 공백으로 시작하지 않고, 공백으로 끝나지 않는다.
위에꺼가 문제임
#include<iostream>
#include<string>
using namespace std;
int main(){
string str;
while (true)
{
getline(cin, str);
if (str=="")
break;
cout << str << endl;
}
return 0;
}
이건 맞다고 뜨는데
#include
#include
using namespace std;
int main()
{
string abc;
while (1)
{
cin >> abc;
if (abc == "")
break;
cout < }
return 0;
}
이건 틀리게뜸
다른점이 뭔가요?
병신이야?
밑에꺼 cout<<abc<<endl;으로 수정;
그러면 띄어쓰기마다 뉴라인 들어가는거잖아
getline(cin, str);랑 cin>>str;이랑 차이가 뭐야?