생활
C++ ostringstream sewt 질문
#include<iostream>
#include<sstream>
#include<string>
#include<iomanip>
using namespace std;
int main() {
string words[] = {"Hello", "C++", "World"};
ostringstream buf;
buf.fill('-');
buf << "+-" << setw(7) << "" << "-+" << endl;
for(string word : words)
buf << "| " << setw(7) << word << " |" << endl;
buf << "+-" << setw(7) << "" << "-+" << endl;
cout << buf.str();
}
여기서 setw(7)옆에 ""를 하면 어떤 효과가 있는것인가요?
그리고 마지막에 cout << buf.str()은 왜 하는 것인가요?
1개의 답변이 있어요!