Functions and Arrays

Hello everyone!
I come here desperate for some help/ tutoring on what to do. I feel so lost in my C++ class..
Here is the description of the assignment:

Write a C++ program that includes two functions named calcavg() and variance(). The calcavg() function should calculate and return the average of values stored in an array named testvals. The array should be declared in main() and include the values 89, 95, 72, 83, 99, 54, 86, 75, 92, 73, 79 75, 82, and 73. The variance is obtained by subtracting the average from each value in testvals, squaring the values obtained, adding them, and dividing by the number of elements in testvals. The values returned from calcavg() and variance() should be displayed by using cout statements in main().

tl;dr here is the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  #include <iostream>
using namespace std;

double calcavg();
double variance();

int main()
{
	const double testvals[] = { 89, 95, 72, 83, 99, 54, 86, 75, 92, 73, 79, 75, 82, 73 };
	
	int calcavg();
	{

	}

	int variance();
	{
		
	}
system("pause");
	return 0;
}


I am not asking for a complete program done for me, but more of a guide to help me through this.
Thanks in advance!
Last edited on
Topic archived. No new replies allowed.