1.Prompts the user for a positive integer >= 0 2.Validates the user input to ensure it...

60.1K

Verified Solution

Question

Programming

1.Prompts the user for a positive integer >= 0

2.Validates the user input to ensure it is a positive integer>= 0

3.Allocate (dynamically) an array big enough for the data.

4.Load the array with random numbers ranging in value from1 to100

5.Display the elements of the array (unsorted)

6.Display the elements of the array (sorted)

7. Display the average

8.Display the median

9.Display the mode, if none, display appropriate message

#include
#include /* srand, rand */
#include /* time */
using namespace std;

// Function prototypes
double median(int *, int);
int mode(int *, int);
int *makeArray(int);
void loadNumberData(int *, int);
void selectionSort(int [], int);
double average(int *, int);
void displayArray(int * numberData, int qtyOfRandomNumbers);
void validateInt(string userIn, int& userInput);

int main()
{
  
}

//function definitions

//*************************************************
//function displayArray
//this function displays the elements of the array
//use pointer arithmetic to step through the array

//*************************************************
//function validateInt ensures that the user input
//is an integer >= 0

//*************************************************
// Function makeArray *
// This function dynamically allocates an array of*
// ints and returns a pointer to it. The parameter*
// size is the number of elements to allocate. *
//*************************************************

//*************************************************
// Function loadNumberData *
// This function loads the array with random numbers*
//ranging in value from 1 to 100
//use pointer arithmetic to step through the array *
//*************************************************


//*************************************************
// Function selectionSort *
// This function performs the selection sort *
// algorithm on array, sorting it into ascending *
// order. The parameter size holds the number of *
// elements in the array. *
//*************************************************

//**************************************************
// Function median *
// This function displays the median of the values *
// in the array pointed to by the parameter arr. *
// The num parameter holds the number of elements *
// in the array. *
//**************************************************

//*********************************************************
// Function mode *
// This function returns the mode of the array pointed to *
// by arr. The mode is the value that appears most often. *
// The parameter num holds the number of elements in the *
// array. If no element appears more than once, the *
// function returns -1. *
//*********************************************************

//**************************************************
// Function average *
// This function calculates and returns the average*
// of the values in the array arr. num is the *
// number of elements in the array. *
//**************************************************

Answer & Explanation Solved by verified expert
4.4 Ratings (931 Votes)
Answerinclude include srand rand include time include using namespace std Function    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students