Practice Question 2–
Simple programming
nRead (x1,y1) and (x2,y2) the coordinates of the two opposite corners of a rectangle. Paint the rectangle in black and invert an oval inside the rectangle boundaries in red.
Solution 1
     int x1, y1, x2, y2; // variable declare
     cout << "\n Enter left : ";  cin  >> x1;
     cout << "\n Enter top : ";  cin  >> y1;
     cout << "\n Enter right : ";    cin  >> x2;
     cout << "\n Enter bottom : "; cin  >> y2;
     SetForeColor(0,0,0); //set color to black
     PaintRect(x1,y1,x2,y2); //paint a rectangle
     InvertOval(x1,y1,x2,y2); //invert an oval
     SetForeColor(255,0,0); //set color to red
     FrameOval(x1,y1,x2,y2); //frame an oval
Solution 2
     int x1, y1, x2, y2;
     x1 = RequestInt("Enter left : ");
     y1 = RequestInt("Enter top : ");
     x2 = RequestInt("Enter right : ");
     y2 = RequestInt("Enter bottom : ");
     SetForeColor(0,0,0);
     PaintRect(x1,y1,x2,y2);
     InvertOval(x1,y1,x2,y2);
     SetForeColor(255,0,0);
     FrameOval(x1,y1,x2,y2);