C++ 의 스트링빌더 std::stringstream
C#의 StringBuilder와 대응되는 기능을 가진 객체로 헤더에 몇가지 객체가 있다. 대표적으로std::stringstream 과std::ostringstream 이 있는데, 둘 다 std::iostream 을 상속받았지만차이점은 전자는 입출력이 가능하고, 후자는 출력전용이다. 비워줄 때는 C#의 StringBuilder랑 동일하게 clear() 를 호출하면된다.#include #include #include using namespace std;int main(void) { string str; int n; cin >> str >> n; std::ostringstream oss; for (int i = 0; i