因為我寫 x=pow(10x+2,(float)1/3)
計得唔o岩ge佢
出哩ge ans係:26815615873518931787257526688330301811796810000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000????
點解ge?
麻煩幫幫忙.....功課......急
唔該晒
更新1:
我用o左你ge 建議=~="都係error........
更新2:
#include #include main() { float x,y,i,a,b,r; i=0; printf("Find the root of the following equation: x^3-10x-2=0 \n"); printf("Please Enter a number x between 0 to 10: ");
更新3:
scanf("%f",&x); printf("Please Enter the Relative Error of x:"); scanf("%f",&y); a=pow(10*2+2,double(1.f/3.f)); b=fabs(a-x)/x;
更新4:
while (b y) { i=i+1; x=a; a=pow(10*x+2,(float) 1/3); b=fabs(a-x)/x;} r=a; printf("The Root of the eqaution is:"); printf("%f",&r); }