gpt4 book ai didi

c - 最终答案为零的方程组

转载 作者:太空宇宙 更新时间:2023-11-04 04:21:25 25 4
gpt4 key购买 nike

<分区>

我创建了这个旨在使用方程式的程序
[F=(CP x CR x D)/(4 x pi x e x ((D^2+R^2)^3/2)]

在哪里

CR = 充电环

CP = 充电点

R = 环的半径

D = 点和环之间的距离

e = 8.85 x 10^-12

F = 力

当我替换值时

CR (0.00002) 为 2.00 x 10^-5

CP (0.00002) 为 2.00 x 10^-05

R 为 0.90

D 为 0.30

最终答案应该是F=1.263759

但我得到的是零。我对编程还很陌生,所以我们将不胜感激

#include <stdio.h>
#include <math.h>

double calculatef(double, double, double, double, double, double);
double main()
{
double CR; //Charge on Ring
double CP; //Charge on point
double R; //radius of Ring
double D; //Distance between the point and ring
double F; //Force

int e = 8.85* pow(10,-12);
printf("Please enter the values for the variables as follows:\n");
printf("-Charge on the ring,\n -Charge on the point,\n -Radius of the ring\n");
printf("-And the Distance between the center of the ring and the point:\n");

scanf("%lf",&CR);
printf("The charge on the ring is: %f\n", CR);

scanf("%lf",&CP);
printf("The charge on the point is: %f\n", CP);

scanf("%lf",&R);
printf("The radius of the ring is: %f\n", R);

scanf("%lf",&D);
printf("The distance between the center of the ring and the point is: %f\n", D);

//The charge on the ring is 2e-005 Coulombs.
//The charge on the point is 2e-005 Coulombs.
//The radius of the ring is 0.90 m.
//The distance between the center of the ring and the point is 0.30 m.
//The force exerted on the point is 1.26 N.

F == calculatef(CR,CP,R,D,e,F);

printf("The force exerted on the point is %.2f\n", F);

system("Pause");
}

double calculatef(double CR, double CP, double R, double D, double e, double F)
{
e = 8.85* pow (10,-12);
F=((D*D) * (R*R));
F=(((CP * CR * D))/(pow(F,3/2)));
F=(F/( 4 * 3.14 * e ));

return(F);
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com