home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c081_11 / 9.ddi / CHAPXMPL.ZIP / CALCAVG.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-13  |  774 b   |  28 lines

  1. // Turbo Assembler    Copyright (c) 1991 By Borland International, Inc.
  2.  
  3. /* CALCAVG.CPP
  4.    The C++ portion of an example of assembler code that calls
  5.    a Borland C++ function in order to get a floating-point
  6.    calculation performed.
  7.  
  8. */
  9.  
  10. // From the Turbo Assembler Users Guide - Interfacing Turbo Assembler
  11. //                                         with Borland C++
  12.  
  13. extern float Average(int far * ValuePtr, int NumberOfValues);
  14. #define NUMBER_OF_TEST_VALUES 10
  15. int TestValues[NUMBER_OF_TEST_VALUES] = {
  16.    1, 2, 3, 4, 5, 6, 7, 8, 9, 10
  17. };
  18.  
  19. main()
  20. {
  21.    printf("The average value is: %f\n",
  22.           Average(TestValues, NUMBER_OF_TEST_VALUES));
  23. }
  24. float IntDivide(int Dividend, int Divisor)
  25. {
  26.    return( (float) Dividend / (float) Divisor );
  27. }
  28.