#include #include float berechne_durchschnitt (int[], int); float berechne_durchschnitt (int array[], int laenge) { float zwischenwert = 0; for (int i = 0; i < laenge; i++) { zwischenwert += array[i]; } return zwischenwert / laenge; } float berechne_durchschnitt2 (int *array) { float zwischenwert = 0; int i; for (i = 0; array[i] != INT_MAX; i++) { zwischenwert += array[i]; } return zwischenwert / i; } int main () { int array[] = { 1, 2, 3 }; std::cout << berechne_durchschnitt (array, 3) << '\n'; int array2[] = { 1, 2, 3, INT_MAX }; std::cout << berechne_durchschnitt2 (array2) << '\n'; }