# include # include # include "dislin.h" int main ( int argc, char *argv[] ); /******************************************************************************/ int main ( int argc, char *argv[] ) /******************************************************************************/ /* Purpose: MAIN demonstrates the use of the CURVE routine. Modified: 01 September 2005 */ { # define N 100 double fpi = 3.1415926 / 180.0; int i; double step; double x; float xray[N]; float y1ray[N]; float y2ray[N]; printf ( "\n" ); printf ( "DISLIN_EX01:\n" ); printf ( " Demonstrate the use of the CURVE routine, for\n" ); printf ( " plotting (X,Y) data.\n" ); step = 360.0 / ( double ) ( N - 1 ); for ( i = 0; i < N; i++ ) { xray[i] = i * step; x = xray[i] * fpi; y1ray[i] = sin ( x ); y2ray[i] = cos ( x ); } /* Specify the format of the output file. */ metafl ( "PNG" ); /* Specify the name of the output graphics file. */ setfil ( "dislin_ex01.png" ); disini ( ); pagera ( ); complx ( ); axspos ( 450, 1800 ); axslen ( 2200, 1200 ); name ( "X-axis", "x" ); name ( "Y-axis", "y" ); labdig ( -1, "x" ); ticks ( 10, "xy" ); titlin ( "Demonstration of CURVE", 1 ); titlin ( "SIN(X), COS(X)", 3 ); graf ( 0.0, 360.0, 0.0, 90.0, -1.0, 1.0, -1.0, 0.5 ); title ( ); color ( "red" ); curve ( xray, y1ray, N ); color ( "green" ); curve ( xray, y2ray, N ); color ( "fore" ); dash ( ); xaxgit ( ); disfin ( ); printf ( "\n" ); printf ( "DISLIN_EX01:\n" ); printf ( " Normal end of execution.\n" ); return 0; }