I am sorry if I am in the wrong forum. I'm just kind of desperate...
I had to work this week and didn't know my class has started to study C++.

Anyway, it's a "gifted" children program and we have some homework which I need some help on. I am currently cracking the books but it's for tomorrow and I don't have a computer in home (so many F words are coming up right now to me...).

I will log in tomorrow to this thread (if it's not deleted, LOL) from my friend's PC.

The programs I have to make are quite different than these but it's some parts of the program that if you show me - I will be able to deduct the rest on my own.

Anyway, it's pretty simple:
C++, arrays only.
1. a) A program that takes two sets of co-ordinates and two radiuses (xA yA rA xB yB rB). These define two imaginary circles. Also, a number (n). Then it would take a number of sets of XY co-ordinates depending on the number n.
(
x1 y1
x2 y2
….
xn yn
)

n, BTW, is a number between 0 and, including, 100. All the data, in fact, is natural numbers, not larger than 100.

The program outputs on the screen how many of the XY co-ordinates fed are INSIDE BOTH circles.

Example:

Input:
2 2 5 1 1 5
3
3 3
2 1
10 20

Output:
2

b) The same program, only that it gives how much numbers are OUTSIDE BOTH circles.

Example:
Input:
2 2 5 1 1 5
3
3 3
2 1
10 20

Output:
1

c) The same program again, only that it gives how much numbers are INSIDE EITHER of the circles.

Example:
Input:
2 2 5 1 1 5
3
3 3
2 1
10 20
Output:
2

Guys, I promise I'll catch up on this material and when my head "thinks in classes" (ie. when I am a C++ Guru myself) I will contribute to this forum.

I really didn't want to work this week but I am saving for my own machine :)

Thanks.

Recommended Answers

All 3 Replies

Sorry, rules are rules. No one here is going to write your program for you.

It is easy calculate the distance of a point from the center of the circle if it is less than the radius the point is inside the circle.

Oh, I have already managed on my own, thanks anyway.

Send this one to the gutters :)

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.