I"m having trouble with this code can any help? I am trying to find the average, mean, standard deviation

``````#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;

void Fill_Array(int Size[], int& count);
void Print_Array(int Size[], int count);
double Calc_Average(int Size[], double average);
void Sort(int Size[], int numbers_used);
int Calc_Median(int median, const int Size[]);
int Calc_Standard_Deviation;
int Variance;
void Print_Array_and_Calculations(int median, double average, int standard_deviation,int Variance);

int main()
{
int count;
int Size [11],
numbers_used = 0,
median = 0;
double average = 0;
double standard_deviation;
double variance;

Fill_Array(Size, count);
Print_Array(Size, count);
average = Calc_Average(Size, average);
Sort(Size, numbers_used);
Calc_Median(median, Size);
Print_Array_and_Calculations(median, average, standard_deviation, variance);

return 0;
}

void Fill_Array(int Size[], int& count, int& number_used)
{
ifstream in_size;
string text_file;

cout << "Enter the file to read in:";
getline(cin, text_file);
cout << endl << "The numbers in the array are:" << endl << endl;

if(in_size.fail())
{
cerr  << "Error opening file";
exit(1);
}

void Print_Array(int Size[], int count)

number_used = 0;
for(int index = 0; index < number_used; index++)
cout << Size[index] << " ";
}

double Calc_Average(int Size[], double average)
{
int total = 0;
for (int i = 0; i < 11; i++)
{
total = total + Size[i];
}
average = double(total) / 11;
{
return average;
}

void Sort(int Size[], int number_used)
{

for (int index = 0; index < number_used - 1; index++)
{
Variance= sum/(n-1);
return variance;
}
int Calc_Median(int median, int Size[])
{
median = Size [ Size/ 11 ];
return median;
}
int Cal_Standard_Deviation(int Cal_Standard_Deviation, int
void Print_Array_and_Calculations(int median, double average,int standard deviation, int variance);
{
cout << "The average of the numbers is " << average;
cout << "The median of the numbers is " << median;
cout << "The standard deviation is " << deviation;
cout << "The Variance is "<<sqrt(variance)<< endl;
}
``````

Edited by mike_2000_17: Fixed formatting

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by frogboy77

1. What is the problem?
2. Code tags code tags code tags.

1. What is the problem?
2. Code tags code tags code tags.

It won't compile. I keep getting errors.

What are the errors?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.