Yurttas/PL/OOL/Cplusplus/F/07/06/01/00/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
19template<class T>
20void put_vector_item(vector<T>& list) {
21  string filename;
22
23  cout << endl;
24  cout << "--> output filename : ";
25  cin >> filename;
26
27  ofstream f_out(filename.c_str());
28
29  int n = list.size();
30
31  for(int i=0; i<n; i++)
32    f_out << list[i] << endl;
33
34  f_out.close();
35}