How do I properly pass the paramaters / overloads needed in the average(); function thats inside my main function? As you can se i created a function that takes two parameters but how do I pass the paramaters in the main?
#include <iostream>
using namespace std;
float average(int v[], int n) {
//n = number of elements
//v = the vector
int sum = 0;
int avg = 0;
for (int i = 0; i <= n; i++) {
cout << "Enter a number: ";
cin >> v[i];
sum += v[i];
}
avg = (double)sum / n;
cout << avg;
return 0;
}
int main() {
average();
}