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;
|