Question: C++ computer science 135 help please!!! I'm having trouble with this final project and any help would be appreciated. Not having much success reading in

 C++ computer science 135 help please!!! I'm having trouble with this

C++ computer science 135 help please!!!

I'm having trouble with this final project and any help would be appreciated. Not having much success reading in a file and putting the results in an output file of my naming. Please help...code is attached.

#include

#include

#include

#include

#include

using namespace std;

const string PROGRAMMER_NAME = "Matthew Harper";

// Global constant

// Prototypes

void file_input();

int data();

void sort(int a[], int n);

void minimum(int a[], int n);

void maximum(int a[], int n);

void average(int a[], int n);

void sd(int a[], int n);

void median(int a[], int n);

int get_mode();

/* -----------------------------------------------------------------------------

FUNCTION: main()

DESCRIPTION: .

RETURNS: 0

NOTES:

------------------------------------------------------------------------------- */

int main()

{

file_input();

cout

cout

cout

system("pause");

return 0;

}

/* -----------------------------------------------------------------------------

FUNCTION: file_input()

DESCRIPTION: array of integer type

RETURNS: 0

NOTES:

------------------------------------------------------------------------------- */

void file_input()

{

ifstream infile;

cout

while (true)

{

string infilename;

getline(cin, infilename);

infile.open(infilename.c_str());

if (!infile) break;

cout

}

}

/* -----------------------------------------------------------------------------

FUNCTION: data()

DESCRIPTION: array of integer type

RETURNS: 0

NOTES:

------------------------------------------------------------------------------- */

int data()

{

return 0;

}

/* -----------------------------------------------------------------------------

FUNCTION: sort()

DESCRIPTION: sort an array of integer type in ascending order

RETURNS:

NOTES:

------------------------------------------------------------------------------- */

void sort(int a[], int n)

{

for (int x = 0; x

for (int y = 0; y

if (a[y] > a [y + 1]) {

int temp = a[y + 1];

a[y + 1] = a[y];

a[y] = temp;

}

}

}

}

/* -----------------------------------------------------------------------------

FUNCTION: get_min()

DESCRIPTION: function will get the minimum value from array

RETURNS: 0

NOTES:

------------------------------------------------------------------------------- */

void minimum(int a[], int n)

{

int min = a[0], i;

for (i = 0;i

if (min>a[i]) min = a[i];

cout

}

/* -----------------------------------------------------------------------------

FUNCTION: get_max()

DESCRIPTION: function will get the maximum value from array

RETURNS: 0

NOTES:

------------------------------------------------------------------------------- */

void maximum(int a[], int n)

{

int max = 0, i;

for (i = 0; i

if (max

cout

}

/* -----------------------------------------------------------------------------

FUNCTION: get_average()

DESCRIPTION: function will compute the average

RETURNS: 0

NOTES:

------------------------------------------------------------------------------- */

void average(int a[], int n)

{

int i;

float sum = 0.0, ave;

for (i = 0;i

sum += a[i];

ave = sum / n;

cout

}

/* -----------------------------------------------------------------------------

FUNCTION: get_SD()

DESCRIPTION: function will compute standard deviation

RETURNS: 0

NOTES:

------------------------------------------------------------------------------- */

void sd(int a[], int n)

{

float ans, sum = 0.0, mean;

int i;

for (i = 0; i

sum += a[i];

mean = sum / 10;

for (i = 0; i

ans += pow(a[i] - mean, 2);

ans = sqrt(ans / n);

cout

}

/* -----------------------------------------------------------------------------

FUNCTION: get_median()

DESCRIPTION: function will compute the median

RETURNS: 0

NOTES:

------------------------------------------------------------------------------- */

void median(int a[], int n)

{

sort(a, n);

if (n % 2 != 0) // odd

{

int temp = ((n + 1) / 2) - 1;

cout

}

else // even

{

cout

}

}

/* -----------------------------------------------------------------------------

FUNCTION: get_mode()

DESCRIPTION: function will compute the mode

RETURNS: 0

NOTES:

------------------------------------------------------------------------------- */

int get_mode()

{

return 0;

}

PROJECT SUMMARY The program shall read an input file consisting of whole numbers, compute statistical values based on those numbers, and write the results to an output file. PROJECT INSTRUCTIONS Write a program to: (1) (2) (3) (4) (5) (6) (7) (8) read a set of whole numbers into an array compute the minimum value compute the maximum value compute the average compute the standard deviation compute the median compute the mode write the results to the terminal screen and to an output file Optionally, for extra credit: (9) draw a histogram for the set of numbers

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!