Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int maximum(int numbers[], int c);
  6. int* oddSwap();
  7. int* expand();
  8. int* concatenate();
  9. int* subArray();
  10.  
  11. const int c = 5;
  12.  
  13. int main()
  14. {
  15.  
  16. int numbers[5] = { 1, 5, 9, 6, 7 };
  17. cout << "testing maximum: " << endl;
  18. cout << "Expected maximum: 9" << endl;
  19. cout << "Actual maximum: " << maximum(numbers, 5) << endl;
  20. cout << endl;
  21. delete[] numbers;
  22.  
  23. system("pause");
  24. return 0;
  25. }
  26. //
  27. int maximum(int numbers, int c)
  28. {
  29.  
  30. int max;
  31. max = 0;
  32.  
  33. for (int count = 0; count <= 5; count++)
  34. {
  35. if (max < numbers[count])
  36. max = numbers[count];
  37. }
  38. return (max);
  39. }
  40. //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement