Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Goal :This assignment is to get familiar with the following : C++ integer array, dynamic array C++ functions , parameters passing, overloading C++ string selection

Goal :This assignment is to get familiar with the following :

C++ integer array, dynamic array

C++ functions , parameters passing, overloading

C++ string

selection sort using C++

C++ format output using printf()

During each pass, the unsorted element with the smallest (or largest) value is moved to its proper position in the array. 

You have to design and implement a C++ console application that : prompts the user to enter a positive integer N , and

generate N random numbers between 0 and 100 (inclusively) and store them in a dynamic integer array.

display the following statistics of the data being generated:

the largest number

the smallest number

the average of the data set. The average must have exactly two digits after the decimal place.

the variance of the data set.

the standard deviation of the data set.

display the data set in the sorted order. (in ascending order)

display the data set in form of histogram.(see the sample output here)

Requirements

In order to achieve the above , you must implement the following functions :

int sum(int a[], int n) ; // return the sum of all elements from the integer array a of size n int sumOfSquare(int a[], int n) ; // return the sum of the square of each element from integer array a of size n int max(int a[] , int n); // return the largest element of the array a of size n int min(int a[], int n) ; // return the smallest element of the array a of size n void maxmin(int a[], int n , int &maxima, int & minima) ; // find the max and min from the given array a of size n double avg(int a[], int n) ; // compute the average of n data storing in the array a double var(int a[], int n ) ; // compute the variance of n data storing in the array a double stdev(int a[], int n) ; // compute the standard deviation of n data storing in the array a void selectionSort(int a[], int n) ; // sort the array a of size n using selectionSort algorithm bool isSorted(int a[], int n) ; // check to see if the integer array a of size n is orted in ascending order or not int * gen( int n, int low = 0 , int up= 100) ; // randomly generates n integer between low and up (inclusively) void print(int a[], int n, int k = 1) ; // display the content of the integer array a of size n , k elements per row string dup(string s, int n ) ; // return a string which is a n-copy of s, e.g. dup("hello ", 3) returns "hello hello hello " string dup(char c, int n ) ; // return a string which is a n-copy of c, e.g. dup('A',5) returns "AAAAA" void stat(int a[], int n) ; // display the statistics of the integer array a of size n void histogram(int a[], int n) ; // display the histogram of the integer data array a of size n 

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

More Books

Students also viewed these Databases questions