/*	Program: 		Click
	Source: 			click.cpp
	Author: 			Chris Brooks
	Date Written: 	October 2000
	Last Revised: 	2000/11/29
									*/
	
// This program promts the the user to click inside or outside a square
// and determines whether or not the user did so successfully

#include "ccc_win.cpp"
#include "BoolOps.h"

int main()
{
	// Builds the square
	
	Line a(Point(0,0), Point(0,1));
	cwin << a;
	a.move(1,0);
	cwin << a;
	
	Line b(Point(0,0), Point(1,0));
	cwin << b;
	b.move(0,1);
	cwin << b;
	
	// Gets Point input and displays point
	
	Point m(0,4);
	Point p = cwin.get_mouse
		("Please click a point inside or outside of the square.");
	cwin << p;
	
	// Determines wether point is inside or outside the square
	// and returns the result
	
	bool x_inside = false;
	if (p.get_x() <= 1 and p.get_x() >= 0);
	else	x_inside = true;
	bool y_inside = false;
	if (p.get_y() <= 1 and p.get_y() >=0);
	else	y_inside = true;
	if (x_inside and y_inside)
		cwin << Message(p, "This point is outside of the square");
	else
		cwin << Message(p, "This point is within the square");	
	return 0;
}
