Yurttas/PL/OOL/Cplusplus/F/07/04/00/iter 00.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   : June 1, 2002.
11   author : Salih Yurttas.
12
13   iter_00.cpp
14*/
15
16
17#include <iostream>
18#include <vector>
19#include <string>
20
21using namespace std;
22
23int main(int argc, char* argv[]) {
24
25  vector<string> v;
26
27  v.push_back("watermelon");
28  v.push_back("strawberry");
29
30  int n = v.size();
31
32  for(int i=0; i<n; i++)
33    cout << v[i] << endl;
34
35  cout << endl;
36
37  for(int i=n-1; i>=0; i--)
38    cout << v[i] << endl;
39
40}