diff --git a/C++Uebungen.cpp b/C++Uebungen.cpp new file mode 100644 index 0000000..afff692 --- /dev/null +++ b/C++Uebungen.cpp @@ -0,0 +1,69 @@ +#include +#include + +using namespace std; + +class mainMenu +{ + int AUSW = -1; + bool CLOSER = false; + + mainMenu() + { + + } + + void run() + { + while (CLOSER == false) + { + //clear(); + cout.write("------------------------Uebungen-Anwendungsentwicklung----------------------"); + cout.write("- (C) ADG 2019 -"); + cout.write("- 1 = Kostenberechnung fuer Mietwagen -"); + cout.write("----------------------------------------------------------------------------\n\n"); + + cout.write("Ihre Auswahl(99 zum Beenden): "); + cin >> AUSW; + } + } +}; + +int main(int argc, char const *argv[]) +{ + mainMenu menu; + + menu.run(); + + +} + +/*TODO: Integrieren in Menu +//Project Euler �bung 2 + int result; + int max = 4000000; + std::queue evens; + + for (int prev = 0, cur = 1, temp = 0; cur < max;) { + temp = cur; + cur = prev + cur; + prev = temp; + if (cur % 2 == 0) + { + evens.push(cur); + std::cout << "current even: " << cur << std::endl; + } + + } + + while (!evens.empty()) + { + result += evens.front(); + evens.pop(); + } + std::cout << "Result: " << result << std::endl; + + return 0; +*/ + + diff --git a/C++_Übung.cpp b/C++_Übung.cpp new file mode 100644 index 0000000..fcc7864 --- /dev/null +++ b/C++_Übung.cpp @@ -0,0 +1,42 @@ +#include +#include + +template +char const* miep(T){ + return __PRETTY_FUNCTION__; +} + +int main(int argc, char const *argv[]) +{ + // int result; + // int max = 4000000; + // std::queue evens; + + // for(int prev = 0, cur = 1, temp = 0; cur < max;) { + // temp = cur; + // cur = prev+cur; + // prev = temp; + // if(cur%2 == 0) + // { + // evens.push(cur); + // std::cout << "current even: " << cur << std::endl; + // } + + // } + + // while(!evens.empty()) + // { + // result += evens.front(); + // evens.pop(); + // } + // std::cout << "Result: " << result << std::endl; + + int a {1u}; + unsigned int b {a}; + + std::cout<< "a: "<< miep('a'+1) << " "<< 'a'+1 <<"\n"; + std::cout<< "b: "<< miep('b'+'a') << " " <<'a'+'b' <<"\n"; + + + return 0; +} diff --git a/C++_Übung.cpp~ b/C++_Übung.cpp~ new file mode 100644 index 0000000..082f7d0 --- /dev/null +++ b/C++_Übung.cpp~ @@ -0,0 +1,21 @@ +#include + +int getSumOfMultiplesWithMaxLimit(int base,int max){ + int sum = 0; + for (int multiplier = 0, result = 0; result <= max; ++i ) + { + result = base * multiplier; + if(result <= max) + sum += result; + + } + return +} + +int main(int argc, char const *argv[]) +{ + int result = getSumOfMultiplesWithMaxLimit(3,1000) + getSumOfMultiplesWithMaxLimit(5,1000) - getSumOfMultiplesWithMaxLimit(15,1000); + cout.write("Result: "+result); + + return 0; +} diff --git a/Euler Übungen 2.cpp b/Euler Übungen 2.cpp new file mode 100644 index 0000000..4a6854c --- /dev/null +++ b/Euler Übungen 2.cpp @@ -0,0 +1,51 @@ +#include +#include + +using namespace std; + +class mainMenu +{ + //Project Euler �bung 2 + int result; + int max = 4000000; + std::queue evens; + + mainMenu() + { + + } + + void run() + { + + for (int prev = 0, cur = 1, temp = 0; cur < max;) { + temp = cur; + cur = prev + cur; + prev = temp; + if (cur % 2 == 0) + { + evens.push(cur); + std::cout << "current even: " << cur << std::endl; + } + + } + + while (!evens.empty()) + { + result += evens.front(); + evens.pop(); + } + std::cout << "Result: " << result << std::endl; + + return 0; + } +}; + +int main(int argc, char const *argv[]) +{ + mainMenu menu; + + menu.run(); + + +}