home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / qc_prog / chap16 / tester.c < prev   
Encoding:
C/C++ Source or Header  |  1988-04-07  |  395 b   |  19 lines

  1. /* tester.c -- demonstrates the assert() macro        */
  2. /* Program list: tester.c (to link math functions)    */
  3.  
  4. #include <assert.h>
  5. #include <stdio.h>
  6. #include <math.h>
  7. main()
  8. {
  9.     float s1 = 3.0;
  10.     float s2 = 4.0;
  11.     float sumsq;
  12.     float hypot;
  13.  
  14.     sumsq = s1*s1 - s2*s2;
  15.     assert(sumsq >= 0);
  16.     hypot = sqrt(sumsq);
  17.     printf("hypotenuse is %.2f\n", hypot);
  18. }
  19.