46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
#include <iostream>
|
|
#include "bsp_1_a.h"
|
|
using namespace std;
|
|
// BSP 1_A
|
|
|
|
int main()
|
|
{
|
|
float a, g, h;
|
|
|
|
// Berechnung der Mittelwerte für verschiedene Testdaten
|
|
mean(1,4,16, a, g, h);
|
|
|
|
cout << "Eingabedaten = (1,4,16)" << endl;
|
|
cout << "arithmetisches Mittel = " << a << endl;
|
|
cout << "geometrisches Mittel = " << g << endl;
|
|
cout << "harmonisches Mittel = " << h << endl;
|
|
|
|
cout << "##########" << endl;
|
|
|
|
mean(2,3,5, a, g, h);
|
|
|
|
cout << "Eingabedaten = (2,3,5)" << endl;
|
|
cout << "arithmetisches Mittel = " << a << endl;
|
|
cout << "geometrisches Mittel = " << g << endl;
|
|
cout << "harmonisches Mittel = " << h << endl;
|
|
|
|
cout << "##########" << endl;
|
|
|
|
mean(1000,4000,16000, a, g, h);
|
|
|
|
cout << "Eingabedaten = (1000,4000,16000)" << endl;
|
|
cout << "arithmetisches Mittel = " << a << endl;
|
|
cout << "geometrisches Mittel = " << g << endl;
|
|
cout << "harmonisches Mittel = " << h << endl;
|
|
|
|
cout << "##########" << endl << "Berechnung via Vektor" << endl;
|
|
|
|
// für Vektoren
|
|
vector<float> x{2,3,5,2,3,5,2,3,5,2,3,5};
|
|
meanvec(x, a, g, h);
|
|
cout << "Eingabedaten = (2,3,5,2,3,5,2,3,5,2,3,5)" << endl;
|
|
cout << "arithmetisches Mittel = " << a << endl;
|
|
cout << "geometrisches Mittel = " << g << endl;
|
|
cout << "harmonisches Mittel = " << h << endl;
|
|
return 0;
|
|
}
|