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

From ZCubes Wiki
Jump to navigation Jump to search
 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_07.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<int> 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    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  }
45
46  put_vector_ints(v);
47
48}