/* nag_dawson (s15afc) Example Program. * * Copyright 2002 Numerical Algorithms Group. * * Mark 7, 2002. */ #include #include #include #include #include int main(int argc, char *argv[]) { FILE *fpin, *fpout; double x, y; Integer exit_status = 0; /* Check for command-line IO options */ fpin = nag_example_file_io(argc, argv, "-data", NULL); fpout = nag_example_file_io(argc, argv, "-results", NULL); /* Skip heading in data file */ fscanf(fpin, "%*[^\n]"); fprintf(fpout, "nag_dawson (s15afc) Example Program Results\n"); fprintf(fpout, " x y\n"); while (fscanf(fpin, "%lf", &x) != EOF) { /* nag_dawson (s15afc). * Dawson's integral */ y = nag_dawson(x); fprintf(fpout, "%12.3e %12.3e\n", x, y); } if (fpin != stdin) fclose(fpin); if (fpout != stdout) fclose(fpout); return exit_status; }