Thank you both very much! The first answer from Chervil compiles properly, but I suspect it to be wrong, since a_max returns a lower value compared to when calculating the average of all a's.
The second answer (Bourgond) looks like it should work, but I cannot compile it. I imagine this occurs because in my code "a" is declared as "double". Simply exchanging "int" with "double" does not work either, I get:
error: invalid types ‘double[int]’ for array subscript
I'll keep trying (absolute beginner). Thanks in any case!
#include <iostream>
usingnamespace std;
int main()
{
int max=0;
for (auto& k: {9,5,4,3,90,-4,91,23,29,-39})
max = (k > max ? k : max);
cout << max << endl;
return 0;
}