1/*
2 Copyright(C) 2005
3 All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
4
5 Permission to use, copy, modify, and distribute this
6 software and its documentation for EDUCATIONAL purposes
7 and without fee is hereby granted provided that this
8 copyright notice appears in all copies.
9
10 date : September 1, 2005.
11 author : Salih Yurttas.
12
13 construct_vector_ints.cpp
14*/
15
16
17#include "common.h"
18
19#include "io.h"
20
21using namespace std;
22
23int count_spaces(const string&);
24
25vector< vector<int> > construct_vector_ints(const vector<string>& v_s) {
26 int n = v_s.size();
27
28 vector< vector<int> > v_v;
29
30 for(int i=0; i<n; ++i) {
31 string s = v_s.at(i);
32 int count = count_spaces(s);
33
34 istringstream ins; // construct an input string stream object.
35 ins.str(s); // specify input string.
36
37 vector<int> v;
38 int a;
39
40 for(int i=0; i<count+1; ++i) {
41 ins >> a; // input the integers from the string.
42 v.push_back(a);
43 }
44 v_v.push_back(v);
45 }
46
47 return v_v;
48}