- Q3 Vector 20 Points Q3 1 Max 10 Points Given An Array Of Int Numbers Write A Function That Return The Maximum Value Of 1 (46.74 KiB) Viewed 31 times
Q3 Vector 20 Points Q3.1 max 10 Points Given an array of int numbers, write a function that return the maximum value of
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Q3 Vector 20 Points Q3.1 max 10 Points Given an array of int numbers, write a function that return the maximum value of
Q3 Vector 20 Points Q3.1 max 10 Points Given an array of int numbers, write a function that return the maximum value of that array. Function prototype is provided below. E.g., 1: (3, 5, 7, -9, 100, 0, -20) 0:100 int maxArr(vecto arr); // you can test your code in main function like this int main(){ } vector<int> arr = (3, 5, 7, 9, 100, 0, -20); cout << maxArr(arr) << endl; NOTES: 1. You only need to put the maxArr function in the answer box (no need for main function). If you use some given functions from C++ libraries, please let me know what headers you include. 2. You need to make sure that your provided code works. The best way to do it is write your code in your computer, make sure it compiles and run properly, then copy then maxArr function and paste it in the answer box. Enter your answer here Save Answer Q3.2 Filter 10 Points Given an array of int numbers arr, write a function that return an array that only contains odd numbers from arr E.g., 1: (2, 6, 5, -7, 9, 4, 13} O: (5, -7, 9, 13) vector<int> oddFilter(vector<int> arr); NOTES: See Q3.1. Enter your answer here Save Answer