c语言----编程
的有关信息介绍如下:#include "stdio.h"#include "math.h"#include "malloc.h"#define G 6.67 /*万有引力常数(G:m^3/(kg*s^2))*/main (){ FILE *fp; int i; double ra,rc,fia,fic; double *Vxz,*Vzz; double p,b,h,q; //double变量用%lf输入可以用%f或%lf输出 printf("\n***********A program of Gravitytabular***********\n"); printf("Remain Dentisity is p\n"); printf("Breadth is b\n"); printf("Burial Depth is h\n"); printf("Dip is q\n"); printf("Please enter the parameters:\n"); scanf("%lf%lf%lf%lf",&p,&b,&h,&q); //变量的顺序和上面提示的顺序不吻合 Vxz=(double *)calloc(50,sizeof(double)); Vzz=(double *)calloc(50,sizeof(double)); fp=fopen("answer2.txt","w"); for(i=0;i<=49;i++) { ra=sqrt(pow((i+b),2)+pow(h,2)); rc=sqrt(pow((i-b),2)+pow(h,2)); fia=atan((b+i)/h); fic=atan((i-b)/h); Vxz[i]=2*G*p*sin(q)*(sin(q)*log(rc/ra)+cos(q)*(fia-fic)); Vzz[i]=2*G*p*sin(q)*(sin(q)*(fia-fic)-cos(q)*log(rc/ra)); Vxz[i]=10*Vxz[i]; Vzz[i]=10000*Vzz[i]; fprintf(fp,"Vxz=%10.4f Vzz=%10.4f\n",Vxz[i],Vzz[i]); } fclose(fp); printf("\n end of transform.\n");}//如果还有疑问我们可以交流交流//祝你学习进步