To make it compile change (inside the
main
function) the
int Greatest4(int a,4);
line to the proper function call
Greatest4(a);
However, making your program
meaningful is more difficult, in my opinion.
[update]
Try the code below:
#include <iostream>
#include <cassert>
using namespace std;
int GreatestOf (int a[], int size)
{
assert(size > 0);
int max = a[0];
for(int i=1; i<size; i++)
{
if(max < a[i])
{
max = a[i];
}
}
return max;
}
int main()
{
int a[4] = { 9, 1, 5, 4};
int size = sizeof(a)/sizeof(a[0]); cout<<"Greatest4 Is:"<< GreatestOf(a, size) << endl;
return 0;
}
[/update]