subject
Engineering, 15.04.2020 15:35 jess7kids98

Write a program that reads in non-negative integers and stores and displays distinct numbers (i. e., if a number appears multiple times, it is stored and displayed only once). Your program should allow up to 1000 distinct numbers to be stored and displayed. Use the following algorithm (this is required!): Read each number and store it in an array if it is new. If the number is already in the array, ignore it. The user will indicate that they are done entering numbers by entering a negative number. Here is a sample run:

Enter a non-negative integer (negative to quit): 1
Enter a non-negative integer (negative to quit): 2
Enter a non-negative integer (negative to quit): 3
Enter a non-negative integer (negative to quit): 2
Enter a non-negative integer (negative to quit): 1
Enter a non-negative integer (negative to quit): 6
Enter a non-negative integer (negative to quit): 3
Enter a non-negative integer (negative to quit): 4
Enter a non-negative integer (negative to quit): 5
Enter a non-negative integer (negative to quit): 2
Enter a non-negative integer (negative to quit): -4
You entered:
1 2 3 6 4 5
To get credit for this assignment you must use appropriate decomposition! You should have a function to read the numbers and a function to print the resulting array. The function that reads the numbers should call an additional function that returns a bool value indicating whether a number is already in the array. At the conclusion of the call to the function that reads the numbers, the array MUST contain only distinct numbers.

Additionally, you must not sort the array. The numbers must appear in the same order in which they were typed.

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Water at 55c flows across a flat plate whose surface temperature is held constant at 95c. if the temperature gradient at the plate's surface for a given value of x is 18 c/mm, find a) local heat transfer coefficient. b) heat flux
Answers: 3
question
Engineering, 04.07.2019 18:10
Calculate the bore of a cylinder that has a stroke of 18 inches and an extension time of 6 seconds at a flow rate of 4 gal/min.
Answers: 3
question
Engineering, 04.07.2019 18:10
An air compression refrigeration system is to have an air pressure of 100 psia in the brine tank and an allowable air temperature increase of 60°f for standard vapor compression cycle temperatures of 77 f entering the expansion cylinder and 14 f entering the compression cylinder, calculate the coefficient of performance a. 2.5 b 3.3 c. 4.0 d. 5.0
Answers: 3
question
Engineering, 04.07.2019 18:20
Most leaks in reciprocating air compressors can be detected and minimized by: (clo4) a)-detecting leakage areas using ultrasonic acoustic detector. b)-tightening joints and connections c)-replacing faulty equipment d)-all of the given options
Answers: 2
You know the right answer?
Write a program that reads in non-negative integers and stores and displays distinct numbers (i. e.,...
Questions
question
Mathematics, 03.12.2021 06:30
question
Chemistry, 03.12.2021 06:30
question
Physics, 03.12.2021 06:30