Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. double* maximum(double* a, int size)
  5. {
  6. if (size == 0)
  7. {
  8. return NULL;
  9. }
  10. double* m = a;
  11. double* p = a;
  12. for (int i = 0; i < size; i++)
  13. {
  14. if (*p > *m)
  15. {
  16. m = p;
  17. }
  18. p++;
  19. }
  20. return m;
  21. }
  22.  
  23. int main()
  24. {
  25. double data[] = {};
  26. double* max = maximum(data, 0);
  27. cout << *max << endl;
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement