我想在C程序中转换此方程来求解方程,但结果总是错误的。我想将所有三个包围方程转换为C代码。我已经对前两个代码进行了编码,但请检查是否有问题。将方程转换为c程序
代码第一方程
#include <stdio.h>
#include <math.h>
int main()
{
/* Define temporary variables */
double r1,r2,u;
double upper,lower,value,result;
printf("Enter coefficients r1");
scanf("%f",&r1);
printf("Enter coefficients r2 ");
scanf("%f,&r2);
printf("Enter coefficients u ");
scanf("%f",&u);
/* Assign the value we will find the cosh of */
value = r1*r2;
/* Calculate the Hyperbolic Cosine of value */
upper = acos(value);
lower = sqrt((u*u)+1) - u;
result = upper/lower;
/* Display the result of the calculation */
printf("The spinner rotaiton angle is %f",result);
return 0;
}
代码第二方程
#include <stdio.h>
#include <math.h>
#include<stdlib.h>
int main()
{
/* Define temporary variables */
double r,w,u;
double a1,result;
printf("Enter coefficients R");
scanf("%f",&r);
printf("Enter coefficients w angular velocity ");
scanf("%f,&w);
printf("Enter coefficients u cofficient of friction");
scanf("%f",&u);
a1 = sqrt((u*u)+1) - u;
a2 = a1*a1;
a3 = sqrt (1 + a2);
result = r * w * a3;
/* Display the result of the calculation */
printf("The departure velocity is %f",result);
scanf(%f);
return 0;
}
也ACOSH即COS双曲线的示值误差 – Nitin
你有什么问题的倒数。 –
'scanf(“%f”,&r1);' - >'scanf(“%lf”,&r1);'etc. – chux