#include <stdio.h> #include <math.h> #include <handy.h> #define PI 3.141592653589793 #define WIDTH 500.0 #define HEIGHT 500.0 int main(void) { int w; double x, y, dx; double A, B, C; w = HgWOpen( 100.0, 100.0, WIDTH, HEIGHT ); dx = 0.1; A = 1.0; B = 1.0; C = 0.0; for( x = 0.0 ; x < WIDTH ; x = x + 0.1 ){ y = A * x * x + B * x + C; HgCircleFill( x, y, 2.0 ); } getchar(); return( 0 ); }を実行すると
#include <stdio.h> #include <math.h> #include <handy.h> #define PI 3.141592653589793 #define WIDTH 500.0 #define HEIGHT 500.0 int main(void) { int w; double x, y, dx; double A, B, C; w = HgWOpen( 100.0, 100.0, WIDTH, HEIGHT ); dx = 0.1; A = 1.0; B = 1.0; C = 0.0; for( x = 0.0 ; x < WIDTH ; x = x + 0.1 ){ y = A * x * x + B * x + C; if( ( x >= 0.0 && x < WIDTH ) && ( y >= 0.0 && y < HEIGHT ) ){ HgCircleFill( x, y, 2.0 ); } } getchar(); return( 0 ); }