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, 22.06.2019 12:50
You have just been hired as an information security engineer for a large, multi-international corporation. unfortunately, your company has suffered multiple security breaches that have threatened customers' trust in the fact that their confidential data and financial assets are private and secured. credit-card information was compromised by an attack that infiltrated the network through a vulnerable wireless connection within the organization. the other breach was an inside job where personal data was stolen because of weak access-control policies within the organization that allowed an unauthorized individual access to valuable data. your job is to develop a risk-management policy that addresses the two security breaches and how to mitigate these risks.requirementswrite a brief description of the case study. it requires two to three pages, based upon the apa style of writing. use transition words; a thesis statement; an introduction, body, and conclusion; and a reference page with at least two references. use a double-spaced, arial font, size 12.
Answers: 1
question
Computers and Technology, 23.06.2019 17:30
What are the most commonly found items in the trash according to the municipal solid waste report?
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a,b] se pot scrie ca produs de două numere prime? “.
Answers: 1
question
Computers and Technology, 23.06.2019 21:30
Enzo’s balance sheet for the month of july is shown. enzo’s balance sheet (july 2013) assets liabilities cash $600 credit card $4,000 investments $500 student loan $2,500 house $120,000 mortgage $80,000 car $6,000 car loan $2,000 total $127,100 total $88,500 which expression finds enzo’s net worth?
Answers: 1
You know the right answer?
Need Help Converting C++ to C code #include

#include

#include

Questions