Description
This lab is to review arrays in C++. While Java arrays have similarities with C++ arrays, there are differences. First, Java arrays are objects, while C++ arrays are just sequential list of elements. The key usage difference is that C++ does not store any information about the array (like length.) Therefore any extraneous information must be stored separately.
Note:Your header file should be in src/arrays.hpp, your C++ code should be in src/arrays.cpp
I do not need a main file.
Implement the following functions:
| /* Returns the number of elements in the array that are less than 0. */ int countNegatives(const int array[], int size);
/* Find the smallest odd value in the array. * Returns -1 if there is no odd value in the array. */ int findMinOdd(const int array[], int size); /* Returns the index in the array where value is found. * Return -1 if the value is not present in the array. */ int search(const int array[], int size, int value); /* Removes an item at position index by shifting later elements left. * Returns true iff 0 <= index < size. */ bool remove(int array[], int size, int index); |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17




