1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
tensa zangetsu [6.8K]
3 years ago
10

You are to write a program that performs basic statistical analysis on a 500 element array of integers. Your program should incl

ude the following programmer defined functions:int* generateArray(int size){This function should dynamically create an array of 501 elements and provide random numbers to fill the array. The random numbers should range from 10 to 100. The function should return the created array to the array generated in the main program.}int findMode(int *arr, int size){This function should analyze the array to find the most occurring value in the array. You do not have to account for bi-modal occurrences, so the first modal value is enough to satisfy this function definition.}int findMedian(int *arr, int size){This function should determine the median of the set of numbers in the array. Since there are 501 elements, you should have a clean median. Do not forget that the list has to be sorted in order to properly find the median.}Of course, main is critical to the function of your program and should output the mode, median of the list. An output of the 501 element array is not necessary.
Computers and Technology
1 answer:
mrs_skeptik [129]3 years ago
3 0

Answer:

#include <iostream>  

#include <cstdlib>  

#include <ctime>  

using namespace std;

int* generateArray(int size)  

{

 int *numbers = new int[size];

 for(int i=0;i<size;i++){

   numbers[i] = (rand()%100) + 10;

 }

 return numbers;  

}

int findMode(int *arr, int size)  

{

 int countMode = 0;

  int mode ;

 int count;

 for(int i=0;i<size;i++) {

    count = 1;

   for(int j=i+1;j<size;j++) {

     if(arr[j] == arr[i] ){

       count++;

      }

     if(count > countMode) {

        countMode = count;

       mode = arr[i];

     }

   }

}

 return mode;

}  

int findMedian(int *arr, int size)  

{

  sort(arr,size);

  int median;

   if(size%2 == 0){

   median = (arr[int((size-1)/2)]+arr[size/2])/2;

 } else{

     median = arr[(size-1)/2];

 }

 return median;

}

void sort(int *arr, int size)

{

 int min;

  for(int i=0;i<size-1;i++) {

    min = i;

    for(int j=i+1;j<size;j++){

     if(arr[j] < arr[min]){

       min = j;

     }

     if(min != i) {

       int temp = arr[i];

       arr[i] = arr[min];

       arr[min] = temp;

     }

   }

 }

}

int main()  

{

 srand(time(0));  

 int size = 501;    

 int *numbers = generateArray(size);

 cout<<"Mode : "<<findMode(numbers,size)<<endl;

 cout<<"Median : "<<findMedian(numbers,size)<<endl;  

 return 0;  

}

 

Explanation:

The C++ program is able to generate 500 integer items into the defined array and statistically analyze and provide the average and modal number in the array of integer dataset.

You might be interested in
True or False?
Karo-lina-s [1.5K]

Answer:

The given statement is False

Explanation:

OSI or Open System Interconnection is a reference model around which the networks are built. OSI gives us all the information regarding movement of data from a software through physical means to another software. Generally it is used as a guidance tool. Seven layers combine to build an OSI model/

TCP/IP (Transmission control protocol/ Internet protocol) model is in a way implementation of the OSI model. It tells about the end-to-end transmission of data being transmitted using OSI model.

<h3>I hope it will help you! </h3>
5 0
3 years ago
Does anyone know how many Brainliests you need to be able to send a private message to someone??
White raven [17]

Answer:

no idea sorry...

Explanation:

8 0
3 years ago
Read 2 more answers
Where must virtualization be enabled for VM (virtual machine) software to work?
Lelu [443]

Answer:

b) BIOS/UEFI

Explanation:

Virtualization can be defined as a technique used for the creation of a virtual platform such as a storage device, operating system, server, desktop, infrastructure or computing resources so as to enable the sharing of resources among multiple end users. Virtualization is usually implemented on a computer which is referred to as the "host" machine.

Generally, virtualization must be enabled in the BIOS/UEFI for VM (virtual machine) software to work.

BIOS is an acronym for Basic Input/Output System while UEFI is an acronym for Unified Extensible Firmware Interface. BIOS/UEFI are low-level software that serves as an intermediary between the operating systems and the computer's firmware or hardware components. The UEFI is actually an improvement of the BIOS and as such is a modernized software.

Basically, the BIOS/UEFI is a software which is an essential tool or feature which must be enabled to link the virtual machine with the hardware components of the computer.

5 0
3 years ago
How to use github to creat a blog?Thank you
stepan [7]
You can use GitHub Pages! They have tutorials on their site to help you set up using that (too much for this format!). You can use it to make your own personal site, as well as host any existing site you may have.
5 0
4 years ago
A(n) ____________ specifies a variable's name and data type.
Alla [95]
I think that would be a function
4 0
3 years ago
Read 2 more answers
Other questions:
  • You are preparing to program a replacement system board, but the "system is booting in mpm mode" message is not displayed. what
    10·2 answers
  • IPhone + iPad + iPod + iPod touch + iMac + MacBook + iBook + Apple =???
    11·2 answers
  • Some classes, like the ArrayList class, use angle brackets in their documentation and their declaration. For example, the Java d
    5·1 answer
  • echnician A says that underinflation can increase the rolling resistance of a tire. Technician B says that underinflation can ca
    9·1 answer
  • Explain what happens if you try to open a file for reading that does not exist.
    10·1 answer
  • Mrs. Zoo gave out the rubric for our essay. She stated that our essay should be complete by Friday of that week. I didn't have t
    13·1 answer
  • Plzz help.... <br><br>i will mark u as brainliest if u answer correct
    10·1 answer
  • Which statement describes how to insert the IF, COUNTIF, or SUM function into a cell?
    11·1 answer
  • Write down the stages in the information prcessing cycle in correct order​
    5·1 answer
  • What enables image processing, speech recognition, and complex game play in Artificial Intelligence (AI)?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!