Your "for" loop is incorrect. it should be:
Originally Posted by dhuan
because emp does not exists. You only have emp and emp.
for(int x=0; x < COMPANY_SIZE; x++)
in "getRichest", you don't need this in the for loop: "highest = (x==0) ? x : highest;" Just initialize "highest" to 0 outside the for loop, then use the for loop to update the value of highest. Otherwise, you'll do that operation at every single iteration; quite wasteful when you have a large array.
Furthermore, since you want to use "highest" as an index, you should declare it to be "int" instead of "float", and also that function need to return type "int".
you can just use C++ notation:
accumulator = accumulator + e[x].salary;
accumulator += e[x].salary;