Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Array Using Cpp Syntax Write a short program that prompts the user and reads in integers into an array called Table. When the user enters

Array Using Cpp Syntax

Write a short program that prompts the user and reads in integers into an array called Table. When the user enters a negative number, the input stops. Keep track of how many numbers were read in (at least 5 and no more than 10; what size should you declare the array to have?)

Then add code to do the following:

  1. Print how many numbers were read in, and then print out all the numbers that were stored in the array.
  2. Find and print the average. Then find and print how many of the numbers are less than the average calculated above, how many are exactly the same value as the average, and how many were greater than the average. Test and make sure it works.
  3. Ask the user for a value and see if it is in the array. If found, the program should print Found at followed by the index where the value was found. Ask the user whether to repeat and keep repeating if the user wants to. (What kind of a loop statement would be good? The body of the loop would be:

Asking user for a value and reading it in.

Searching for the value in the array and printing either Not found. or Found at index .. Asking user whether to continue and reading in the answer.)

Test using different values. At a minimum, test using the following values:

1) value not in the array.

2) the first value of the array,

3) the last value in the array

4) value in the array somewhere between the first and the last values.

4. Find and print the smallest value in the array AND the index where it is located. Then write code that will swap the smallest value and the first value in the array.

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions

Question

Explain the various employee benefit laws.

Answered: 1 week ago