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

class Point {
  int x;
  int y;
 public:
  Point(int seed = 0) : x(seed), y(seed) {
    cout << "Overloaded constructor called.\n";
  }
  ~Point() { cout << "Destructor called.\n"; }
  int getX() { return x; }
  int getY() { return y; }
};

ostream& operator<< (ostream& os, Point& p) {
  os << "(" << p.getX() << "," << p.getY() << ")";
  return os;
}

template <typename T>
void print (T *array, int size) {
  for (int i = 0; i < size; i++)
    cout << array[i] << " ";
  cout << endl;
}
void addFront (points, size, newPoint); 
void addEnd (points, size, newPoint);
void removeFront(points, size);
void removeEnd(points,size);
// Add codes.
int main() {
  int seed = 0;         // seed for automatic value of x and y.
  int size = 0;         // array size.
  Point *points = NULL; // dynamic array.
  int choice; // user choice.
  Point newPoint;
  do {
    print (points, size);
    cout << "Choice:\n"
         << "1: Add new point at the front\n"
         << "2: Add new point at the end\n"
         << "3: Remove point at the front\n"
         << "4: Remove point at the end\n"
         << "Others: Exit\n";
    cin >> choice;
    switch (choice) {
      case 1 : newPoint = Point(++seed);
               addFront (points, size, newPoint); break;
      case 2 : newPoint = Point(++seed);
               addEnd (points, size, newPoint); break;
      case 3 : removeFront (points, size); break;
      case 4 : removeEnd (points, size); break;   
    }
  } while (choice >= 1 && choice <= 4);
  print (points, size);
  if (size > 0)
    delete [] points;
}
//Function declaration
void addFront (points, size, newPoint);
{

}
void addEnd (points, size, newPoint);
{

}
void removeFront (points, size);
{

}
void removeEnd (points, size);
{

}
This article has been dead for over six months. Start a new discussion instead.