Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise 1 : Write a program with multiple functions that reads an array of type int and prints the number of occurrences of the numbers
Exercise : Write a program with multiple functions that reads an array of type int and prints the
number of occurrences of the numbers in an array. You might assume that there are fewer than
entries in an array. The description of the functions are:
One function to collect up to numbers. The number of entries, elements, in an array is
entered by the user and each number is also collected from the keyboard. The numbers
must be between and If a user enters a number that is not between and the
collecting process will stop. Save the numbers in an array.
One function to count how many times the number each distinct number in the array is
repeating. The count is saved in the new array.
One function to prompt the result as:
Number Number of occurrences
Exercise : Sum of the value in each row and colum of a by matrix D array
For exercise student will create a program that will sum value in each row and column of a
dimension array. The program will:
o Set the size of an array as a global constant variable with value of
o define function randColorRange Function randColorRange is used to randomly
generate a value between and and return the value as an integer.
o Define function populatematrix Function populatematrix is used to
populate the by matrix. It means that each cell of the rows and columns will be
populated with one random number. This random number is obtained by using function
randColorRange
o define function printColorRange Function printColorRange is used to print the
value in each cell of the by array.
o define function sumRowCol Function sumRowCol is used to sum the values in each
row and column of the by array.
o Define function promptsumRowCol The function is used to print the result of the
sums as:
Sum in column
Sum in column
Sum in column
Sum in row
Sum in row
Sum in row
The main function should only be used to call each function.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started