scaltest.c 359 B

1234567891011121314151617181920
  1. #ifdef __cplusplus
  2. #include <iostream>
  3. extern "C"
  4. #else
  5. #include <stdio.h>
  6. #endif
  7. int scalprod(int n, double* x, double* y, double* res);
  8. int main()
  9. {
  10. double a[5] = { 1., 2., 3., 4., 5. };
  11. double b[5] = { 2., 3., 4., 5., 6. };
  12. double rk;
  13. scalprod(5, a, b, &rk);
  14. #ifdef __cplusplus
  15. std::cout << rk << std::endl;
  16. #else
  17. printf("%f\n", rk);
  18. #endif
  19. }