Code:
#include <iostream.h>
#include <math.h>
#include <stdlib.h>

enum Color {Red, Blue, White, Green, Yellow};

const double TEMP = 0.0; // when Val is not needed
const Color TEMPC = White; // when color is not needed

void Disply (Color);
void Pnt (char, double); 
void ClrPnt (char, double, Color);

void main () {
  
  Pnt('O', TEMP);
  Pnt('P', TEMP);
  Pnt('X', 8.0);
  Pnt('P', TEMP);
  Pnt('Y', 7.0);
  Pnt('P', TEMP);
  Pnt('X', 2.0);
  Pnt('P', TEMP);
  Pnt('X', 3.0);
  Pnt('P', TEMP);
  Pnt('O', TEMP);
  Pnt('P', TEMP);
  ClrPnt('O',TEMP,TEMPC);
  ClrPnt('P',TEMP,TEMPC);
  ClrPnt('C',TEMP,Blue);
  ClrPnt('P',TEMP,TEMPC);
  ClrPnt('X',2.0,TEMPC);
  ClrPnt('P',TEMP,TEMPC);
}

void Pnt (char MSG, double Val) {
  static double X-co = 0.0;
  static double Y-co = 0.0;
  static double distance = 0.0;

  switch (MSG) {
  case 'X': // move along x direction
    X-co = X-co + Val;
    break;
  case 'Y': // move along y direction
    Y-co = Y-co + Val;
    break;
  case 'O': // move to origin
    X-co = 0.0;
    Y-co = 0.0;
    break;
  case 'P': // print coordinates, distance
    cout << "Current Position x = " << X-co << ", y = " << Y-co << endl;
    cout << "Distance " << distance << endl;
    break;
  default: 
    cout << "Unknown MSG to Pnt" << endl;
    exit(-1);
  }
  distance = sqrt (X-co * X-co + Y-co * Y-co);
  return;
}

void ClrPnt (char MSG, double Val, Color color) {
  static Color col = White;

  switch (MSG) {
  case 'X':
  case 'Y': 
  case 'O':
    Pnt(MSG,Val);
    break;
  case 'C': // set color
    col = color;
    break;
  case 'P': // print coordinates, distance, and color
    Pnt('P',TEMP);
    cout << "Color";
    Disply(col);
    cout << endl;
    break;
  default: 
    cout << "Unknown ClrPnt" << endl;
    exit(-1);
  }
  return;
}

void Disply (Color col) {
  switch (col) {
      
  case Violet: 
    cout << "Violet";
    break;
  case Red: 
    cout << "Red";
    break;
  case Pink: 
    cout << "Pink";
    break;
  case Green: 
    cout << "Green";
    break;
  case Brown:
    cout << "Brown";
    break;
  }
}