subject

Need Help Converting C++ to C code #include

#include

#include

#include

#include

#include

using namespace std;

//Function Declarations

void fillArrayWithRandNos(int nos[],int size);

void displayArray(int nos[],int size);

double mean(int nos[],int size);

double variance(int nos[],int size);

double median(int nos[],int size);

int mode(int nos[],int size);

void histogram(int nos[],int size);

int main() {

//Declaring variables

const int size=200;

srand(time(NULL));

// Creating array dynamically

int* nos = new int[size];

//Calling the functions

fillArrayWithRandNos(nos, size);

displayArray(nos, size);

cout<<"Mean :"< nos[j])

{

temp = nos[i];

nos[i] = nos[j];

nos[j] = temp;

}

}

}

int middle;

float med;

middle = (size / 2.0);

if (size % 2 == 0)

med = ((nos[middle - 1]) + (nos[middle])) / 2.0;

else

med = (nos[middle]);

return med;

}

int mode(int nos[],int size)

{

int counter1 = 0, counter2, modevalue;

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

counter2 = 0;

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

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

counter2++;

}

if (counter2 > counter1) {

counter1 = counter2;

modevalue = nos[i];

}

}

}

if (counter1 > 1)

return modevalue;

else

return 0;

}

void histogram(int nos[],int size)

{

int hist[9]={0};

for(int i=0;i =55 && nos[i]<=59)

{

hist[0]++;

}

else if(nos[i]>=60 && nos[i]<=64)

{

hist[1]++;

}

else if(nos[i]>=65 && nos[i]<=69)

{

hist[2]++;

}

else if(nos[i]>=70 && nos[i]<=74)

{

hist[3]++;

}

else if(nos[i]>=75 && nos[i]<=79)

{

hist[4]++;

}

else if(nos[i]>=80 && nos[i]<=84)

{

hist[5]++;

}

else if(nos[i]>=85 && nos[i]<=89)

{

hist[6]++;

}

else if(nos[i]>=90 && nos[i]<=94)

{

hist[7]++;

}

else if(nos[i]>=95 && nos[i]<=99)

{

hist[8]++;

}

}

cout<<"Displaying the count of numbers in each interval:"<

int cnt=0;

for(int i=55;i<=99;i+=5)

{

cout<

cnt++;

}

cout<<"Displaying the histogram :"<
cnt=0;

for(int i=55;i<=99;i+=5)

{

cout<
for(int j=0;j
{

cout<<"*";

}

cout<
cnt++;

}

}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:30
Given the following code: if (n == 2) { k -= 2; } else if (n == 3) { k -= 3; } can be rewritten as: if (< condition > ) { < assignment statement > ; } assume that evaluating < condition > does not change the values stored in n and k. which of the following could be used as < assignment statement > ? k -= n; k -= 1; k -= 2; k += n; k = n - k;
Answers: 2
question
Computers and Technology, 21.06.2019 22:00
Draw the hierarchy chart and design the logic for a program that calculates service charges for hazel's housecleaning service. the program contains housekeeping, detail loop, and end-of-job modules. the main program declares any needed global variables and constants and calls the other modules. the housekeeping module displays a prompt for and accepts a customer's last name. while the user does not enter for the name, the detail loop accepts the number of bathrooms and the number of other rooms to be cleaned. the service charge is computed as $40 plus $15 for each bathroom and $10 for each of the other rooms. the detail loop also displays the service charge and then prompts the user for the next customer's name. the end-of-job module, which executes after the user enters the sentinel value for the name, displays a message that indicates the program is complete.
Answers: 2
question
Computers and Technology, 23.06.2019 13:30
Me ! evelyn is a manager in a retail unit. she wants to prepare a report on the projected profit for the next year. which function can she use? a. pmt b. round c. division d. what-if analysis
Answers: 2
question
Computers and Technology, 23.06.2019 22:40
22. sata3 allows for data transfer rates of 600 mb/s. explain why you would likely not be able to copy data from one hard drive to another at anywhere close to this speed. also, what could be upgraded on the computer to achieve transfer speeds closer to 600 mb/s
Answers: 1
You know the right answer?
Need Help Converting C++ to C code #include

#include

#include

Questions
question
Mathematics, 12.10.2020 14:01
question
History, 12.10.2020 14:01
question
Advanced Placement (AP), 12.10.2020 14:01
question
Mathematics, 12.10.2020 14:01
Questions on the website: 13722361