Home / utk / cs102 / fa16 / labi / code_snippets / section1 / osstream.cpp
Directory Listing
array_reference.cpp
getline.cpp
isstream.cpp
namelist.txt
numbers.txt
osstream.cpp
recordgen.c
result2.txt
result4.txt
student_info.cpp
sum.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <sstream>

using namespace std;

int main() {
	double values[5] = { 1, 2, 3, 4, 5.5 };
	//Result we are looking for is "1, 2, 3, 4, 5.5, "
	
	ostringstream sout;
	for (int i = 0; i < 5; i++) {
		sout << values[i] << ", ";
	}

	cout << sout.str() << endl;
}