#include #include #include #include #include "funktionen.h" void welcome() { char x[15]; printf("Hallo! Wie heisst du?\n"); scanf("%s", &x); printf("\nSchöner Name, %s!\n\n", x); } int choose_program() { int i; printf("Welches der folgenden Programme moechtest du starten?\n1. Rechner.exe\n2. Gleichungen.exe\n3. TicTacToe.exe\n\n"); scanf("%d", &i); return i; } int addThreeNumbers(int a, int b, int c) { return a + b + c; } int multiply(int h, int g) { return h * g; } int subtract(int num1, int num2) { return num1 - num2; } int divide(int num1, int num2) { return num1 / num2; } int power(int base, int power) { int speicher = 1; for (int i = 0; i < power; i++) { speicher *= base; } return speicher; } int x_wins_00_10_20(char board[][3]) { if (board[0][0] == 'X' && board[1][0] == 'X' && board[2][0] == 'X') { return 1; } } int x_wins_01_11_21(char board[][3]) { if (board[0][1] == 'X' && board[1][1] == 'X' && board[2][1] == 'X') { return 1; } } int x_wins_02_12_22(char board[][3]) { if (board[0][2] == 'X' && board[1][2] == 'X' && board[2][2] == 'X') { return 1; } } int x_wins_00_01_02(char board[][3]) { if (board[0][0] == 'X' && board[0][1] == 'X' && board[0][2] == 'X') { return 1; } } int o_wins_00_10_20(char board[][3]) { if (board[0][0] == 'O' && board[1][0] == 'O' && board[2][0] == 'O') { return 1; } } int o_wins_01_11_21(char board[][3]) { if (board[0][1] == 'O' && board[1][1] == 'O' && board[2][1] == 'O') { return 1; } } int o_wins_02_12_22(char board[][3]) { if (board[0][2] == 'O' && board[1][2] == 'O' && board[2][2] == 'O') { return 1; } } int o_wins_00_01_02(char board[][3]) { if (board[0][0] == 'O' && board[0][1] == 'O' && board[0][2] == 'O') { return 1; } } int string_character_counter(char string[]) { int stringLength = 0; for (int i = 0; string[i] != '\0'; i++) { stringLength++; } return stringLength; } int characterAppearanceInString(char c, char string[]) { int appear = 0; for (int i = 0; i < string_character_counter(string); i++) { if (string[i] == c) { appear++; } } return appear; } int i(int v, int r) { return v / r; } int p(int f, int a) { return f / a; } // Function to calculate the sine of an angle in radians float sine(float x) { return sin(x); } // Function to calculate the cosine of an angle in radians float cosine(float x) { return cos(x); } // Function to calculate the tangent of an angle in radians float tangent(float x) { return tan(x); } // Function to calculate the arc sine of a value and return the result in radians float arcSine(float x) { if (x >= -1 && x <= 1) { return asin(x); } else { printf("Error: Invalid input for arc sine!\n"); return 0; } } // Function to calculate the arc cosine of a value and return the result in radians float arcCosine(float x) { if (x >= -1 && x <= 1) { return acos(x); } else { printf("Error: Invalid input for arc cosine!\n"); return 0; } } // Function to calculate the arc tangent of a value and return the result in radians float arcTangent(float x) { return atan(x); } // Function to convert degrees to radians float degreesToRadians(float x) { return x * (M_PI / 180); } // Function to convert radians to degrees float radiansToDegrees(float x) { return x * (180 / M_PI); } // Function to calculate the base 10 logarithm of a number and add 1 float logarithmPlusOne(float x) { if (x > 0) { return log10(x) + 1; } else { printf("Error: Invalid input for logarithm + 1!\n"); return 0; } } // Function to calculate the natural logarithm (base e) of a number and add 1 float naturalLogarithmPlusOne(float x) { if (x > 0) { return log(x) + 1; } else { printf("Error: Invalid input for natural logarithm + 1!\n"); return 0; } } // Function to calculate the square root of a number and add 1 float squareRootPlusOne(float x) { if (x >= 0) { return sqrt(x) + 1; } else { printf("Error: Invalid input for square root + 1!\n"); return 0; } } // Function to calculate the cube root of a number and add 1 float cubeRootPlusOne(float x) { return cbrt(x) + 1; } // Function to calculate the sine of an angle in degrees float sineDegrees(float x) { return sin(degreesToRadians(x)); } // Function to calculate the cosine of an angle in degrees float cosineDegrees(float x) { return cos(degreesToRadians(x)); } // Function to calculate the tangent of an angle in degrees float tangentDegrees(float x) { return tan(degreesToRadians(x)); } // Function to calculate the square of a number float square(float x) { return x * x; } float squareRoot(float x) { if (x >= 0) { return sqrt(x); } else { printf("Error: Invalid input for square root!\n"); return 0; } } // Function to calculate the cube of a number float cube(float x) { return x * x * x; } // Function to calculate the cube root of a number float cubeRoot(float x) { return cbrt(x); } // Function to calculate the absolute value of a number float absolute(float x) { return fabs(x); } // Function to calculate the logarithm (base 10) of a number float logarithm(float x) { if (x > 0) { return log10(x); } else { printf("Error: Invalid input for logarithm!\n"); return 0; } } // Function to calculate the natural logarithm (base e) of a number float naturalLogarithm(float x) { if (x > 0) { return log(x); } else { printf("Error: Invalid input for natural logarithm!\n"); return 0; } } // Function to calculate the factorial of a number int factorial(int x) { if (x >= 0) { int result = 1; for (int i = 1; i <= x; i++) { result *= i; } return result; } else { printf("Error: Invalid input for factorial!\n"); return 0; } } // Function to calculate the floor value of a number float floorValue(float x) { return floor(x); } // Function to calculate the ceiling value of a number float ceilingValue(float x) { return ceil(x); } // Function to calculate the absolute difference between two numbers float absoluteDifference(float x, float y) { return fabs(x - y); } // Function to calculate the maximum of two numbers float maximum(float x, float y) { return fmax(x, y); } // Function to calculate the minimum of two numbers float minimum(float x, float y) { return fmin(x, y); } // Function to calculate the average of two numbers float average(float x, float y) { return (x + y) / 2; } // Function to calculate the remainder of division between two numbers float remainderValue(float x, float y) { return fmod(x, y); }