@emilia A database table? Or do you mean an array? Then somewhat like this:
int biggest(int array[]) {
int biggest = array[0];
for(int i=1; i<array.length; i++) {
if (array[i] > biggest) {
biggest = array[i];
}
}
return biggest;
}
double average(int array[]) {
double sum = 0;
for(int i=0; i<array.length; i++) {
sum += array[i];
}
return sum/array.length;
}
Maybe array.length or double is wrong in C++, I only know Java. The rest should be the same.