阅读(3681) (4)

hypot

2015-11-11 15:38:57 更新


 原型:extern float hypot(float x, float y);
 
 用法:#include <math.h>
 
 功能:对于给定的直角三角形的两个直角边,求其斜边的长度。
 
 说明:返回斜边值。
 
 举例:


     // hypot.c
     
     #include <syslib.h>
     #include <math.h>
     main()
     {
       clrscr();        // clear screen
       textmode(0x00);  // 6 lines per LCD screen
     
       printf("3^2+4^2=%.0f^2\n",hypot(3.,4.));
       printf("3.2^2+4.3^2=%.2f^2",hypot(x,y));
       
       getchar();
       return 0;
     }