https://check-in.uni-heidelberg.de/erfassung/6205.03.104/
Error:
-Wall:
-Weverything:
Sonst gerne auch gleich in der Übungsphase!
int max(int a, int b) {
return a > b ? a : b;
}
SOMETYPE max(SOMETYPE a, SOMETYPE b) {
return a > b ? a : b;
}
double max(double a, double b) {
return a > b ? a : b;
}
float max(float a, float b) {
return a > b ? a : b;
}
cppinsights.io
#include <iostream>
template <int N>
struct Factorial {
enum { val = Factorial<N-1>::val * N };
};
template<>
struct Factorial<0> {
enum { val = 1 };
};
int main() {
// Note this value is generated at compile time.
// Also note that most compilers have a limit on the depth of the recursion available.
std::cout << Factorial<4>::val << "\n";
}
Note to Self: Siehe Files!
Übungsblatt 07 im Moodlekurs
Christian Heusel c.heusel@stud.uni-heidelberg.de https://discord.mathphys.info