There is a cycle of plotting the function f (x) = x * x * x - 10 * x * x - 3 * x + 59 using LineTo. But when displaying, broken lines are obtained, how can this be corrected?

x, y - coordinates of the center of the screen (500; 250)

kx, ky - scaling factors for x and y, respectively (Scaling when the window is changed)

i * 14 - equalized the width of the chart, without this it draws very narrowly.

enter image description here

for( int i = -10;i <= 10;i++){ LineTo(hdc, x + (i*14)*kx, y - f(i)*ky); } 
  • 3
    Well, do it more often - type, for(double i = -10;i <= 10;i+=0.05) ... - Harry
  • I didn’t even think about it, it solved the problem - Andrey Kuzmin
  • one
    Even in WinAPI there are functions for drawing Bezier curves, for example PolyBezier . - freim Nov.

0