Dateien nach „BSP_1_A“ hochladen

This commit is contained in:
Georg Thomas Mandl 2025-10-22 23:13:05 +02:00
commit 97a7a2432d
4 changed files with 166 additions and 0 deletions

46
BSP_1_A/main.cpp Normal file
View file

@ -0,0 +1,46 @@
#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;
}