Yurttas/PL/OOL/Cplusplus/F/05/04/03/01/put vector item.cpp

From ZCubes Wiki
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 2002
 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   : January 1, 2002.
11   author : Salih Yurttas.
12
13   put_vector_item.cpp
14*/
15
16
17#include "get_put_vector_item.h"
18
19using namespace std;
20
21template<class T>
22void put_vector_item(vector<T>& list) {
23  string filename;
24
25  cout << "--> output filename : ";
26  cin >> filename;
27  cout << endl;
28
29  ofstream f_out(filename.c_str());
30
31  int n = list.size();
32
33  for(int i=0; i<n; i++)
34    f_out << list[i] << endl;
35
36  f_out.close();
37}