Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Given an integer array named numbers that contains 22 elements. Write both a regular for loop, as well as a range-based for loop where

1. Given an integer array named numbers that contains 22 elements. Write both a regular for loop, as well as a range-based for loop where both loops display each of the elements in the array.

2. Given two double arrays named valueArray1 and valueArray2 that each have 42 elements, write the C++ code that will copy all the values from valueArray2 to valueArray1.

3. Compose the code necessary to declare a string array named countries that can hold up to fifteen entries. Also compose the code to declare an integer array named populations that can also hold up to fifteen entries. These two arrays are intended to be used in parallel. Assume that a different part of the program this code is part of will load values into the parallel arrays you declared. Show the code you created to declare these arrays along with code that will display each of the countrys names and their corresponding population values.

4. Is there anything seriously wrong with the following code? If so, explain and provide a remedy.

int SIZE = 25;

double values[SIZE];

for (int i = 1; i < SIZE; i++)

{

values[i] = 0.0;

}

5. Compose a C++ function that accepts an array of integer values and the number of entries in the array as arguments and returns the total of the values in the array as a double data type variable.

Programming Exercise (50 points):

Create a C++ program that asks the user to enter up to a maximum of 30 numbers. Inform the user that entering a sentinel value of -999 will terminate the data entry phase of the program. The program will store the numbers in an array of doubles and then display the following information:

  • The lowest number in the array. (The number with the smallest value.)
  • The highest number in the array. (The number with the greatest value.)
  • The count of the number of valid entries made by the user. (Do not count entering the sentinel value as a valid entry.)
  • The total of the numbers in the array.
  • The average value of the numbers in the array.

    1. Given an integer array named numbers that contains 22 elements. Write both a regular for loop, as well as a range-based for loop where both loops display each of the elements in the array.

    2. Given two double arrays named valueArray1 and valueArray2 that each have 42 elements, write the C++ code that will copy all the values from valueArray2 to valueArray1.

    3. Compose the code necessary to declare a string array named countries that can hold up to fifteen entries. Also compose the code to declare an integer array named populations that can also hold up to fifteen entries. These two arrays are intended to be used in parallel. Assume that a different part of the program this code is part of will load values into the parallel arrays you declared. Show the code you created to declare these arrays along with code that will display each of the countrys names and their corresponding population values.

    4. Is there anything seriously wrong with the following code? If so, explain and provide a remedy.

    int SIZE = 25;

    double values[SIZE];

    for (int i = 1; i < SIZE; i++)

    {

    values[i] = 0.0;

    }

    5. Compose a C++ function that accepts an array of integer values and the number of entries in the array as arguments and returns the total of the values in the array as a double data type variable.

    Programming Exercise (50 points):

    Create a C++ program that asks the user to enter up to a maximum of 30 numbers. Inform the user that entering a sentinel value of -999 will terminate the data entry phase of the program. The program will store the numbers in an array of doubles and then display the following information:

  • The lowest number in the array. (The number with the smallest value.)
  • The highest number in the array. (The number with the greatest value.)
  • The count of the number of valid entries made by the user. (Do not count entering the sentinel value as a valid entry.)
  • The total of the numbers in the array.
  • The average value of the numbers in the array.

    1. Given an integer array named numbers that contains 22 elements. Write both a regular for loop, as well as a range-based for loop where both loops display each of the elements in the array.

    2. Given two double arrays named valueArray1 and valueArray2 that each have 42 elements, write the C++ code that will copy all the values from valueArray2 to valueArray1.

    3. Compose the code necessary to declare a string array named countries that can hold up to fifteen entries. Also compose the code to declare an integer array named populations that can also hold up to fifteen entries. These two arrays are intended to be used in parallel. Assume that a different part of the program this code is part of will load values into the parallel arrays you declared. Show the code you created to declare these arrays along with code that will display each of the countrys names and their corresponding population values.

    4. Is there anything seriously wrong with the following code? If so, explain and provide a remedy.

    int SIZE = 25;

    double values[SIZE];

    for (int i = 1; i < SIZE; i++)

    {

    values[i] = 0.0;

    }

    5. Compose a C++ function that accepts an array of integer values and the number of entries in the array as arguments and returns the total of the values in the array as a double data type variable.

    Programming Exercise (50 points):

    Create a C++ program that asks the user to enter up to a maximum of 30 numbers. Inform the user that entering a sentinel value of -999 will terminate the data entry phase of the program. The program will store the numbers in an array of doubles and then display the following information:

  • The lowest number in the array. (The number with the smallest value.)
  • The highest number in the array. (The number with the greatest value.)
  • The count of the number of valid entries made by the user. (Do not count entering the sentinel value as a valid entry.)
  • The total of the numbers in the array.
  • The average value of the numbers in the array.

    1. Given an integer array named numbers that contains 22 elements. Write both a regular for loop, as well as a range-based for loop where both loops display each of the elements in the array.

    2. Given two double arrays named valueArray1 and valueArray2 that each have 42 elements, write the C++ code that will copy all the values from valueArray2 to valueArray1.

    3. Compose the code necessary to declare a string array named countries that can hold up to fifteen entries. Also compose the code to declare an integer array named populations that can also hold up to fifteen entries. These two arrays are intended to be used in parallel. Assume that a different part of the program this code is part of will load values into the parallel arrays you declared. Show the code you created to declare these arrays along with code that will display each of the countrys names and their corresponding population values.

    4. Is there anything seriously wrong with the following code? If so, explain and provide a remedy.

    int SIZE = 25;

    double values[SIZE];

    for (int i = 1; i < SIZE; i++)

    {

    values[i] = 0.0;

    }

    5. Compose a C++ function that accepts an array of integer values and the number of entries in the array as arguments and returns the total of the values in the array as a double data type variable.

    Programming Exercise (50 points):

    Create a C++ program that asks the user to enter up to a maximum of 30 numbers. Inform the user that entering a sentinel value of -999 will terminate the data entry phase of the program. The program will store the numbers in an array of doubles and then display the following information:

  • The lowest number in the array. (The number with the smallest value.)
  • The highest number in the array. (The number with the greatest value.)
  • The count of the number of valid entries made by the user. (Do not count entering the sentinel value as a valid entry.)
  • The total of the numbers in the array.
  • The average value of the numbers in the array.

    1. Given an integer array named numbers that contains 22 elements. Write both a regular for loop, as well as a range-based for loop where both loops display each of the elements in the array.

    2. Given two double arrays named valueArray1 and valueArray2 that each have 42 elements, write the C++ code that will copy all the values from valueArray2 to valueArray1.

    3. Compose the code necessary to declare a string array named countries that can hold up to fifteen entries. Also compose the code to declare an integer array named populations that can also hold up to fifteen entries. These two arrays are intended to be used in parallel. Assume that a different part of the program this code is part of will load values into the parallel arrays you declared. Show the code you created to declare these arrays along with code that will display each of the countrys names and their corresponding population values.

    4. Is there anything seriously wrong with the following code? If so, explain and provide a remedy.

    int SIZE = 25;

    double values[SIZE];

    for (int i = 1; i < SIZE; i++)

    {

    values[i] = 0.0;

    }

    5. Compose a C++ function that accepts an array of integer values and the number of entries in the array as arguments and returns the total of the values in the array as a double data type variable.

    Programming Exercise (50 points):

    Create a C++ program that asks the user to enter up to a maximum of 30 numbers. Inform the user that entering a sentinel value of -999 will terminate the data entry phase of the program. The program will store the numbers in an array of doubles and then display the following information:

  • The lowest number in the array. (The number with the smallest value.)
  • The highest number in the array. (The number with the greatest value.)
  • The count of the number of valid entries made by the user. (Do not count entering the sentinel value as a valid entry.)
  • The total of the numbers in the array.
  • The average value of the numbers in the array.

Type or paste question here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

18. If you have power, then people will dislike and fear you.

Answered: 1 week ago