Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have to write a program that reads in a list of integers into an array with the base type of an int. The next

I have to write a program that reads in a list of integers into an array with the base type of an int. The next thing is I have to either read this array from the keyboard OR from a file, depending on what the user wants. If the user wants file input, the program should ask for a file name. We may assume that there are fewer than 50 entries in the array. The program should determine how many entries there are. The output should be a two-column list that has the first column in the list be a list of the distinct array elements. The second column will be the count of the number of occurences of each of the elements. The result should be outputted in a file and on the screen. The list should also be sorted on entries in the first column from largest to smallest. Use the input file input.txt or let the user input from the keyboard. image text in transcribedimage text in transcribed

Algorithm/Pseudo-code for Exercise 2 1. You need three integer arrays to solve this exercise: inputArray, uniqueArray, countArray. An integer variable "size" is used to keep track of 2. Read the integers into inputArrav, The number of elements is saved in 3. Sort the input array in ascending order. Use the selection sort algorithm in 4. Initialize the elements in countArray to be zero. how many elements are in inputArrav. variable "size" Chap. 7. for (int1 = 0; 1

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

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

More Books

Students also viewed these Databases questions