What kind of equation(s) would I use for this program?

I'm trying to find out what equation to use in the x and y point finder for this program. I need it to find the 15 points on the circle that is divided into 16 separate pieces. You of course input the center point and the first one. I made an array to store the points that are found, but as to how to get the points is at a loss for me at the moment. Any help would be appreciated.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <cmath>
#include <iomanip>
#include <iostream>

using namespace std;

const double PI = 3.14;

void main()
{
	double h, k, radius, diameter, area, circumference;
	double x[14], y[14];
	

	cout << "Enter the coordinates of the center point: \n";
	cout << "X Coordinate: ";
	cin >> x;
	cout << "Y Coordinate: ";
	cin >> y;

	cout << "\n\nEnter the coordinates of the outside point: \n";
	cout << "X coordinate: ";
	cin >> h;
	cout << "Y coordinate: ";
	cin >> k;


	//equations
	radius = sqrt (pow ((h - x), 2) + (pow ((k - y), 2)));
	diameter = radius * 2;
	area = PI * (pow (radius, 2));
	circumference = PI * (diameter);

	//x point finder
	for(int i = 0; i < 14; i++)
	{

	}
	//y point finder
	for(int i = 0; i < 14; i++)
	{

	}





	//output
	cout << "\n\nThe measurements of the circle are: \n";
	cout << "Radius: " << radius << 
		"\nDiameter: " << diameter << 
		"\nArea: " << area <<
		"\nCircumference: " << circumference <<
		"\n\n15 other points on the circle are: " <<


	//point output
	for(int i = 0; i < 14; i++)
	{
		cout << "Point "<< i + 2 << " = "<< x[i] << y[i] << endl;
	}		
}


closed account (D80DSL3A)
You need variables for the circles center location.
This code won't work because x and y are names of arrays.
1
2
3
4
5
cout << "Enter the coordinates of the center point: \n";
	cout << "X Coordinate: ";
	cin >> x;
	cout << "Y Coordinate: ";
	cin >> y;

I'll use xc and yc for the center coords. Appropriate equations for lines 37 and 42 could be:
x[i] = xc + radius*cos(2*PI*(double)i/14.0);
and
y[i] = yc + radius*sin(2*PI*(double)i/14.0);
You will need to define PI.
Topic archived. No new replies allowed.