Differing variable input question

Hi all,

I'm working on an assignment where the user inputs the center coordinates(x,y) for an circular array of (x,y) points.
The program performs some calculations, then outputs the position of each point, based on the diameter and center location.

The issue I'm having is that the number of points is a variable(inputted by the user).
I can't figure out how to make the program perform the calculations for a different number of points each time.

I feel like there's a simple solution, and that I'm not seeing due to my inexperience.

Thanks

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
// Assignment 3 Bolt position Calculator
// Calculates position of bolts on plate using number of points, hole diameter, and (x,y) coordinate of center

#include<iostream>;
#include<math.h>;
#include<cmath>;

#define PI 3.14159

using namespace std;

int main()
{
    int n,
    float D,x,y,A; 
    //D= diameter of pattern, n= number of holes, x= x coordinate of center point, y= y coordinate of center point, A= Angle between the center of each hole
    
    std::cout <<setprecision(4);
    cout << fixed;
    
    cout <<"Please enter the diameter of the pattern in millimeters";
    cin >> D; 
    
    cout <<"Please enter the number of holes";
    cin >> n;
    
    cout <<"Please enter the x coordinate of the center of the pattern"; 
    cin >> x;
    
    cout <<"Please enter the y coordinate of the center of the pattern";
    cin >> y;
    
    A= (PI*2)/n;
    
    if (x = 0,y = 0)
    {
    cout <<"At 0.0000: x=" << x <<", y=" << Y;
    x1= ((cosA)*(D))
    y1= ((sinA)*(D))
    }
    else
    {
    cout <<"At 0.0000: x=" << 0+x <<", y=" << 0+y;
Topic archived. No new replies allowed.