Please help i'm trying to click on the screen just inside the box coordinates of (x,y) but it clicks everywhere on the screen!!

void cursorpoint()
{

 	#include "cursor.h"

	int x ;
	int y ;

	

	//x will have the x position and y will have the y position of mouse where clicked.
	for(;;)
	{
		   	where_mouse(x,y); //this will wait for mouse to be clicked
			gotoxy(x,y);    //This will position the cursor at x,y on the screen

	  if  (x >= 11 && x <= 69  && (x % 2) == 0 && y >= 6 && y <= 14  && (y  % 2) != 0 ) break;		// x odd numbers
	    	
		 {  
			cout << (char)219;
			cout << x << y;
			break; 
			
	   	 }	 

	}	


}

line 4: put all includes at the top of the file before anything else. It might compile the way you have it but its not the standard practice to put includes inside functions like that.

As for your actual problem -- don't know.

I need to include the cusor.h library file thought to do the where_mouse(x,y) and gotoxy(x,y). I just don't know why the if statement is implemented fully. it shud stop me clickin on outside the coordinates of the box but doesn't. Tanks anyways for your reply.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.