how to create dynamically Point point[] to use in (place the x, y values from computation within a for loop)

43 views Asked by At

how to create dynamically Point point[] (place the x, y values from computation within a for loop) then use in LineTo GDI+ within for loop with a point array? LineTo(hdc, point1, point2);

want to create the Point[] points array from

for (int c = 0; c < N; c++) {
points[c]= ( radius*sin(theta*c), radius*cos(theta*c) );
}

all attempt to create the array has error

this the code found and trying to change it to GDI+ C++:

https://cpp.hotexamples.com/examples/-/-/lineTo/cpp-lineto-function-examples.html

void rosette(Hdc hdc)
{
int N = 10;
float radius = 100.0;

int N = 100; float radius = 150;   PI = 3.14;
Point *pointlist = new Point[N];
float theta = (2.0f * PI) / N;
float angle = theta / 2;
for (int c = 0; c < N; c++) {
pointlist[c]= (radius*sin(theta*c), radius*cos(theta*c));
}

for (int i = 0; i < N-1; i++) {
MoveTo(hdc,  pointlist[i], NULL);
LineTo(hdc,   pointlist[i+1]);
}
lineTo(hdc,  pointlist[0]);
}

all attempt to create the array has error

this the code found and trying to change it to GDI+ C++:

0

There are 0 answers