Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am having a lot of trouble understanding arrays. I started some code (below) a

ID: 3660044 • Letter: I

Question

I am having a lot of trouble understanding arrays. I started some code (below) and the instructions are below that. I don't expect that anyone writes the whole code but I could use any help. Thank you.

Code:

Synopsis: Reads a list of user inputted non-negative numbers into an array. Finds the minimum value, subtracts the minimum value from each array number, then outputs to the console the minimum number and the modified array. */
#include <iostream> using namespace std;
int main() { const int ARRAY_SIZE(100); int list[ARRAY_SIZE]; double numElements[ARRAY_SIZE]; double x[ARRAY_SIZE]; cout << "Enter list of " << ARRAY_SIZE << " non-negative integers ending with -100: "; while (numElements<ARRAY_SIZE && x /= -100) { array[numElements] } }

Instructions:

Write a program which prompts the user for input and reads a list of non-negative numbers (type double) into an array, finds the minimum value in the array, subtracts the minimum value from each array number and then outputs to the console the minimum number and the modified array. The input list is terminated by a -100. The program should have a function find_min() for finding minimum number in the array, and a procedure array_subtract() which subtracts a number from each element of the array. 1. A function prototype should be written for each function/procedure and placed BEFORE the main function. All functions/procedures should be written AFTER the main procedure. Each function/procedure should have a comment explaining what it does, and each function/procedure parameter should have a comment explaining the parameter. 2. Declare a constant variable storing the array size of 100. This constant variable can either be a global constant or can be declared in the function main(). 3. Prompt the user for the list of non-negative numbers terminated by -100. You do not need to check that the numbers are non-negative. The inputs may be floating point numbers (saved as double). Read the numbers into an array which stores double precision floating point numbers. The number of elements in the input list may be less than 100. Stop reading when either the input number is a - 100 or when 100 numbers have been read in to the array. The -100 is not part of the input list and should not be stored in the array. 4. Use the following algorithm to read in a non-negative list of numbers terminated by -100. 1 numElements ? 0 2 cin >> x 3 while (numElements < SIZE, AND x ? -100) do 4 array[numElements] ? x 5 numElements ? numElements+1 6 cin >> x 7 end 5. Write a function find_min() which returns the value of the smallest element in the array of numbers. The function should take two parameters, the array and the number of elements in the array. The function should return the value of the smallest element in the array. Hint: Examples of passing an array into a function along with I am having a lot of trouble understanding arrays. I started some code (below) and the instructions are below that. I don't expect that anyone writes the whole code but I could use any help. Thank you.

Code:

Synopsis: Reads a list of user inputted non-negative numbers into an array. Finds the minimum value, subtracts the minimum value from each array number, then outputs to the console the minimum number and the modified array. */
#include <iostream> using namespace std;
int main() { const int ARRAY_SIZE(100); int list[ARRAY_SIZE]; double numElements[ARRAY_SIZE]; double x[ARRAY_SIZE]; cout << "Enter list of " << ARRAY_SIZE << " non-negative integers ending with -100: "; while (numElements<ARRAY_SIZE && x /= -100) { array[numElements] } }

Instructions:

Write a program which prompts the user for input and reads a list of non-negative numbers (type double) into an array, finds the minimum value in the array, subtracts the minimum value from each array number and then outputs to the console the minimum number and the modified array. The input list is terminated by a -100. The program should have a function find_min() for finding minimum number in the array, and a procedure array_subtract() which subtracts a number from each element of the array. 1. A function prototype should be written for each function/procedure and placed BEFORE the main function. All functions/procedures should be written AFTER the main procedure. Each function/procedure should have a comment explaining what it does, and each function/procedure parameter should have a comment explaining the parameter. 2. Declare a constant variable storing the array size of 100. This constant variable can either be a global constant or can be declared in the function main(). 3. Prompt the user for the list of non-negative numbers terminated by -100. You do not need to check that the numbers are non-negative. The inputs may be floating point numbers (saved as double). Read the numbers into an array which stores double precision floating point numbers. The number of elements in the input list may be less than 100. Stop reading when either the input number is a - 100 or when 100 numbers have been read in to the array. The -100 is not part of the input list and should not be stored in the array. 4. Use the following algorithm to read in a non-negative list of numbers terminated by -100. 1 numElements ? 0 2 cin >> x 3 while (numElements < SIZE, AND x ? -100) do 4 array[numElements] ? x 5 numElements ? numElements+1 6 cin >> x 7 end Write a program which prompts the user for input and reads a list of non-negative numbers (type double) into an array, finds the minimum value in the array, subtracts the minimum value from each array number and then outputs to the console the minimum number and the modified array. The input list is terminated by a -100. The program should have a function find_min() for finding minimum number in the array, and a procedure array_subtract() which subtracts a number from each element of the array. 1. A function prototype should be written for each function/procedure and placed BEFORE the main function. All functions/procedures should be written AFTER the main procedure. Each function/procedure should have a comment explaining what it does, and each function/procedure parameter should have a comment explaining the parameter. 2. Declare a constant variable storing the array size of 100. This constant variable can either be a global constant or can be declared in the function main(). 3. Prompt the user for the list of non-negative numbers terminated by -100. You do not need to check that the numbers are non-negative. The inputs may be floating point numbers (saved as double). Read the numbers into an array which stores double precision floating point numbers. The number of elements in the input list may be less than 100. Stop reading when either the input number is a - 100 or when 100 numbers have been read in to the array. The -100 is not part of the input list and should not be stored in the array. 4. Use the following algorithm to read in a non-negative list of numbers terminated by -100. 1 numElements ? 0 2 cin >> x 3 while (numElements < SIZE, AND x ? -100) do 4 array[numElements] ? x 5 numElements ? numElements+1 6 cin >> x 5. Write a function find_min() which returns the value of the smallest element in the array of numbers. The function should take two parameters, the array and the number of elements in the array. The function should return the value of the smallest element in the array. Hint: Examples of passing an array into a function along with 5. Write a function find_min() which returns the value of the smallest element in the array of numbers. The function should take two parameters, the array and the number of elements in the array. The function should return the value of the smallest element in the array. Hint: Examples of passing an array into a function along with

Explanation / Answer

it's a good start, but arrays are not hard to understand. All you have to remember is that C/Cpp start indexing from 0, not 1 you while statement should be: while (numElements