Home / utk / cs102 / fa16 / labi / code_snippets / section1 / isstream.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
17
18
19
20
21
#include <iostream>
#include <sstream>

using namespace std;

int main() {
	string str = "23 26 0 3.4 12.98";
	double values[5];

	istringstream sin;
	sin.str(str);

	for (int i = 0; i < 5; i++) {
		sin >> values[i];
		values[i] *= 2.5;
	}
	
	for (int i = 0; i < 5; i++) {
		cout << values[i] << endl;
	}
}