Yurttas/PL/OOL/Cplusplus/F/06/02/01/08/io gs 08.cpp

 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   io_gs_08.cpp
14*/
15
16
17#include "common.h"
18
19#include "io.h"
20
21#include "f_specs.h"
22
23int main(int argc, char* argv[]) {
24
25  vector<string> v_s = get_vector_lines();
26
27  int n = v_s.size();
28
29  vector< vector<int> > v_v;
30
31  for(int i=0; i<n; ++i) {
32    string s = v_s.at(i);
33    int count = count_spaces(s);
34
35    istringstream ins;             // construct an input string stream object.
36    ins.str(s);                    // specify input string.
37
38    vector<int> v;
39    int a;
40
41    for(int i=0; i<count+1; ++i) {
42      ins >> a;                    // input the integers from the string.
43      v.push_back(a);
44    }
45    v_v.push_back(v);
46  }
47
48  put_vector_ints(v_v);
49
50}