473,410 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,410 software developers and data experts.

how to find if a point lies within a square

my question ask to n in_out(xs,ys,side) that takes three numbers as input, where
side is non-negative. Here xs and ys represent the x and y coordinates of the bottom
left corner of a square; and side represents the length of the side of the square.
(Notice that xs, ys, and side completely define a square and its position in the plane).
Your function should first prompt the user to enter two numbers that represent the x
and y coordinates of some query point. Your function should print True if the given
query point is inside of the given square, otherwise it should print False. A point on the
boundary of a square is considered to be inside the square
Sep 24 '17 #1
1 1977
Rabbit
12,516 Expert Mod 8TB
If you have the coordinates of the bottom left corner and the length of the sides, then all you need to do is check that the user inputted x is between the left and right side x's and the y is between the top and bottom y's.

What have you tried to far?
Sep 25 '17 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Charlie Sugden | last post by:
This app successfully used a configuration file to map various app constants Since porting the app to the a service, I can no longer access the configration information. The new service runs fine...
2
by: Ben O'Steen | last post by:
Scenario: ========= Using PyGame in particular, I am trying to write an application that will run a scripted timeline of events, eg at 5.5 seconds, play xxx.mp3 and put the image of a ball on...
2
by: Rosa | last post by:
Hi, I'm looking for an elegant solution on how to find the youngest file within a given directory. At the moment I'm storing all files in an array and loop through it comparing the creation date...
0
by: Herfried K. Wagner [MVP] | last post by:
* "=?Utf-8?B?QnJpYW5ESA==?=" <BrianDH@discussions.microsoft.com> scripsit: Double post. -- Herfried K. Wagner <URL:http://dotnet.mvps.org/>
1
by: Namshub | last post by:
I was wondering if there is a simple method of replacing characters within the xml document. I'm looking at writing a Biztalk Pipeline that escapes illegal characters before they are processed...
1
by: renu | last post by:
Hello, I have drawn polygon on window. And I want to check wheather given point is in that polygon region or not? How shold I find that? I have created object of class region GraphicsPath path...
1
by: Randy | last post by:
I'm struggling with identifying whether a user has clicked on the left or right arrows within the MonthCalendar controls. I had a good suggestion to trap the mouse coordinates that the user clicks...
1
by: amiparna | last post by:
There is two frame in my form.In d first frame there is a text box,and i give some word in the text box.I want to search the word from a file from the location(http://45.12.09.31...........) and if...
4
by: red222 | last post by:
I am trying to find a string within a substring using strstr. This only works with char arrays. I have an array of objects of which I am searching a particular property which is a string. char...
3
by: Ciremo | last post by:
I've made a simple script which asks questions, and writes the answers into a file (Answers.txt) However, the only way I get it to work is to define the entire path, e.g. C:\folder\Answers.txt But...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.