From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- Bachelor/Prog1/probeklausur/main.cpp | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Bachelor/Prog1/probeklausur/main.cpp (limited to 'Bachelor/Prog1/probeklausur/main.cpp') diff --git a/Bachelor/Prog1/probeklausur/main.cpp b/Bachelor/Prog1/probeklausur/main.cpp new file mode 100644 index 0000000..a96bd6f --- /dev/null +++ b/Bachelor/Prog1/probeklausur/main.cpp @@ -0,0 +1,67 @@ +// Sven Eisenhauer +// Probeklausur 09.02.2005 +// +// Application to test class LottoGenerator + +#include "lotto.h" +#include +using std::cout; +using std::endl; +#include +using std::setw; + +int average(int *); + +const int ARRAY_SIZE=6; + +int main() +{ + LottoGenerator lotto; + int nrEinstZusatzZ=0; + long ZusatzZ; + int erg[ARRAY_SIZE]; + const int NUMBERS=49; + int result[NUMBERS]={0}; + int avg=0; + + for(int i=0;i<10;i++) + { + lotto.drawAllNumbers(); + lotto.sortSixNumbers(); + lotto.printAllNumbers(); + } + + for(i=0;i<1000000;i++) + { + lotto.drawAllNumbers(); + ZusatzZ=lotto.getAllNumbers(erg); + if(ZusatzZ<10) + nrEinstZusatzZ++; + } + cout << endl << "Eine einstellige Zusatzzahl gab es "<< nrEinstZusatzZ <<" mal."; + + for(i=0;i<1000000;i++) + { + lotto.drawAllNumbers(); + lotto.getAllNumbers(erg); + avg=average(erg); + result[avg]++; + } + + cout << endl <<"Häufigkeitsverteilung: " << endl; + for (i=0;i