[SOLVED] Data Structure-lab 6 Review of C++ Arrays

20.99 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

5/5 - (1 vote)

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

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.