国外的c数值算法书籍源程序(Numerical Recipes Source- C2.02)

源代码在线查看: xerffc.c

软件大小: 731 K
上传用户: anlan001
关键词: Numerical Recipes Source 2.02
下载地址: 免注册下载 普通下载 VIP

相关代码

				/* Driver for routine erffc */
				
				#include 
				#include 
				#include "nr.h"
				#include "nrutil.h"
				
				#define MAXSTR 80
				
				main()
				{
					char txt[MAXSTR];
					int i,nval;
					float x,val;
					FILE *fp;
				
					if ((fp = fopen("fncval.dat","r")) == NULL)
						nrerror("Data file fncval.dat not found\n");
					fgets(txt,MAXSTR,fp);
					while (strncmp(txt,"Error Function",14)) {
						fgets(txt,MAXSTR,fp);
						if (feof(fp)) nrerror("Data not found in fncval.dat\n");
					}
					fscanf(fp,"%d %*s",&nval);
					printf("\ncomplementary error function\n");
					printf("%5s %12s %13s\n","x","actual","erfc(x)");
					for (i=1;i						fscanf(fp,"%f %f",&x,&val);
						val=1.0-val;
						printf("%6.2f %12.7f %12.7f\n",x,val,erffc(x));
					}
					fclose(fp);
					return 0;
				}
							

相关资源