ChinaUnix.net
相关文章推荐:

sqrt c语言实现

Here is what I wrote, very inefficient though. #include double mysqrt( double v, double accu ); double myfabs( double val ); int main( void ) { double value,accuracy; printf( "Enter the value you want to compute square root please :\n" ); scanf( "%lf", &value ); printf( "Please specify the accuracy you want please :\n" ); scanf( "%lf", &accuracy ); printf( "The square root of %lf...

by fedoracore4 - C/C++ - 2006-01-11 12:55:42 阅读(844) 回复(2)

相关讨论

今天写一个计算平方根的程序, 发现 没有 sqrt() 函数,我认为是我代码有问题, 于是写了几行简单的代码试一下, 代码如下: [code] #include ; #include ; int main() { double ck; ck=100.00; ck=sqrt(ck); printf("%f\n",ck); return 1; } [/code] 但还是错误 提示如下: /tmp/cc2DfpAZ.o(.text+0x2a): In function `main': : undefined reference to `sqrt' collect2: ld returned 1 exit sta...

by UNIX-COW - C/C++ - 2005-08-16 22:54:06 阅读(585) 回复(2)

請問下,Tuboc下的庫函數math.h在UNIX系統編譯下的名稱為何?

by mct2100 - Linux论坛 - 2005-04-13 10:07:39 阅读(302) 回复(0)

在两个不同的代码里面,一个找不到sqrt,而另外一个可以找到,不知道是为什么? 第一个代码是: #include #include #include struct Point {     int x;     int y; }; typedef struct Point point; double distance(point a, point b) {     int x,y;     x = abs(a.x - b.x);     y = abs(a.y...

by ccbobocat - C/C++ - 2009-05-14 23:13:57 阅读(968) 回复(6)

我的系统是ubuntu-8.10-desktop-amd64,我想用函数sqrt(),但是编译出错.代码如下: #include #include int main() { float fn, fres; double dn, dres; printf("Enter a float number: "); scanf("%f", &fn); fres = sqrtf(fn); printf("The result of sqrt(%f) = %f\n", fn, fres); printf("Enter a double number: "); scanf("%lf", &dn); dres = sqrt(dn); print...

by smily2006 - C/C++ - 2009-01-18 14:33:23 阅读(7141) 回复(13)

代码:/*try.c*/ #include #include main() { int a,b; scanf("%d",&a); b=sqrt(a); printf("%d",b); } 此代码在turboc下编译没有报错,但在unix下用cc -o try try.c 报错!难道在头文件math.h中没有sqrt()函数??

by LEMMONTREE - C/C++ - 2008-07-04 23:53:44 阅读(2704) 回复(14)

sqrt(25)-int(sqrt(25))在windows的计算器为什么不等于0 在lua(测试过了)是等于0的。 为什么啊:em14:

by wengyingwei - C/C++ - 2009-09-22 16:31:49 阅读(760) 回复(0)

#include #include int main() { float a, b, c, x1, x2, disc; printf("input a,b,c : "); scanf("%f,%f,%f\n", &a, &b, &c); if (fabs(a) < 1e-6) printf("the equation is not a quadratic"); else { disc = b * b - 4 * a * c; if (disc < 0) printf("the equation has not rea...

by happytor - C/C++ - 2008-10-25 11:02:20 阅读(2491) 回复(10)

#include #include int main(void) { float area=10; area = sqrt(area); return 0; } /*========================== gcc test.c /tmp/cc6oUCa1.o(.text+0x4b): In function `main': test.c: undefined reference to `sqrt' collect2: ld 返回 1 =====================*/ 如果把 area = sqrt(area);改为 area = sqrt(10); 就没问题,为什么呢?

by dwtsteven - C/C++ - 2006-06-11 01:19:41 阅读(1023) 回复(8)

在SCO UNIX下/usr/include/math.h中有 math.h:extern double sqrt(double); 为什么我写程序时调用该函数调不了,报了一个找不到该函数ndefined first referenced symbol in file sqrt 3e.o i386ld fatal: Symbol referencing errors. No output written to 3e 怎样能调用该函数?

by zouceng - C/C++ - 2009-03-27 18:11:36 阅读(764) 回复(2)