I am trying to complete this program, but i cant get it to work.
So i should create this function with the following head
"float medel(int v[], int n)"
so the function should take the total sum in the array in main and return the average number the array has.
So i know in my head how it should work, but i cant write it out... and now looking if someone can guide me in the right direction.
atm my main looks like this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
#include <iostream>
#include "medel.h"
; using namespace std;
int main()
{
int n = 5;
float speed[] = { 30, 50, 75, 100, 110 };
float speedsum = speed[0] + speed[1] + speed[2] + speed[3] + speed[4];
float medel = speedsum;
cout << medel << endl;
}
|
and my function looks like this
1 2 3 4 5 6 7 8
|
float medel(int speedsum, int n)
{
float medel = speedsum / n;
return medel;
}
|
I get the following error when i try to run it
Error C4335 Mac file format detected: please convert the source file to either DOS or UNIX format
What am i doing wrong?
Thanks for any help given :)