Demonstrating the STL vector back and pop_back operations

Started by aruljothi, Jun 11, 2009, 07:04 PM

Previous topic - Next topic

aruljothi

 
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main()
{
  string s("abcdefghij");

  vector<char> vector1(s.begin(), s.end());

  while (vector1.size() > 0) {
    cout << vector1.back();
    vector1.pop_back();
  }
  cout << endl;
  return 0;
}