Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Need to get a C++ program for the following criteria:

Need to get a C++ program for the following criteria:

 User will enter a value (N) which represents the number of values to process

    user enters N numbers in the range of -2147483648 to 2147483647

     The values entered will be stored in an array of type long that has 1,000 elements

    program will count the number of different (distinct/unique) values in the array

    The count (number) of different values will be displayed (no other output is necessary)

Example: 2, 3, 4, 3, 3, 5, 2, 9, 5    count of unique values is 5; number of duplicates 4

Here is what I have so far:

#include <iostream> 

using namespace std;

void input_data(long data[], short size);

void display_data (long data[], short size);

short count_distinct(long num[], short size); // value returning function

int main()

{  

  short size; // list not complete, add variables as needed

  cin>>size;

  while (size > 0)  

  {

    cout<<"To run the program again, enter the number of values to store in the array or 0 to terminate the program";

    cin>>size;

  }

  return 0;    

}  

void display_data(long data[], short size)

// Function to input(store) data into the array

void input_data(long data[], short size)

//Function to return the count of the number of unique/distinct values in the array

short count_distinct(long num[], short size)

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question