#ifndef Prog_h
#define Prog_h
class Prog
{
public:
int Array[];
int N;
void ReadList(int Array[], int N);
void Avgs (int Array[], int N, int &Ave, int &aveP, int &AveN);
int Large (int Array[], int N);
void Display(int Array[], int N, int Ave, int AveP, int AveN, int Max);
};
#endif
is there something to add in my header? or wrong?i'm making a program for these functions, i just saw it to my friend notes:
[void ReadList(int Array[ ], int N)
This will read in a list of N values, where N is already knownvoid Avgs (int Array[], int N, int &Ave, int &aveP, int &AveN)
Array is a one-dimensional array of integers and N is the number of elements in that array. Both of these are input parameters to the function. The function must calculate 1) the average of the N integers in Array and return the result in Ave, 2) the average of the positive numbers (> 0) and return the result in AveP, and 3) the average of the negative numbers (< 0) and return the result in AveN.int Large (int Array[], int N)
Array is a one-dimensional array of signed integers and N is the number of elements in that array. The function returns the value of the largest element in the array.void Display(int Array[ ], int N, int Ave, int AveP, int AveN, int Max)
This will display the list of values (nicely formatted) together with the averages and the largest value.
but theres a condition that i must have a file for .h and .cpp...
#include <iostream>
using namespace std;
int main()
{
int Array[10]= {4, -30, 0, 7, 42, -20, 18, 400, -123, -6};
cout << Display(int Array[], int N, int Ave, int AveP, int AveN, int Max)
return 0;
}
I also make this for main .cpp means that i will use three files. another one is for my four functions. i'm not yet finish in doing those functions cause i dont know if im doing ryt in header. could somebody help me?