32 lines
923 B
C++
32 lines
923 B
C++
#include "bsp_1_b.h"
|
|
#include <iostream>
|
|
#include <algorithm>
|
|
using namespace std;
|
|
// BSP 1_B
|
|
|
|
int main()
|
|
{
|
|
const string name1("data_1.txt"); // name of input file
|
|
const string name2("out.txt"); // name of output file
|
|
vector<short int> v;
|
|
|
|
read_vector_from_file(name1, v);
|
|
|
|
float a, g, h, d, minv, maxv;
|
|
meandevvec(v,a,g,h,d);
|
|
minv = *min_element(v.begin(),v.end());
|
|
maxv = *max_element(v.begin(),v.end());
|
|
|
|
cout << "Auswertung" << endl;
|
|
cout << "arithmetisches Mittel: " << a << endl;
|
|
cout << "geometrisches Mittel: " << g << endl;
|
|
cout << "harmonisches Mittel: " << h << endl;
|
|
cout << "deviation/Standardabweichung: " << d << endl;
|
|
cout << "Minimum: " << minv << endl;
|
|
cout << "Maximum: " << maxv << endl;
|
|
|
|
vector<float> ve{a,g,h,d,minv,maxv};
|
|
write_vector_to_file(name2, ve);
|
|
|
|
return 0;
|
|
}
|