|
|
@ -6,45 +6,19 @@ |
|
|
|
|
|
|
|
|
|
|
|
void welcome() { |
|
|
|
char x[15]; |
|
|
|
char username[15]; |
|
|
|
printf("Hallo! Wie heisst du?\n"); |
|
|
|
scanf("%s", &x); |
|
|
|
printf("\nSchöner Name, %s!\n\n", x); |
|
|
|
scanf("%s", &username); |
|
|
|
printf("\nSchöner Name, %s!\n\n", username); |
|
|
|
} |
|
|
|
|
|
|
|
int choose_program() { |
|
|
|
int i; |
|
|
|
int choice; |
|
|
|
|
|
|
|
printf("Welches der folgenden Programme moechtest du starten?\n1. Rechner.exe\n2. Gleichungen.exe\n3. TicTacToe.exe\n\n"); |
|
|
|
scanf("%d", &i); |
|
|
|
printf("Welches der folgenden Programme moechtest du starten?\n1. Rechner.exe\n2. Gleichungen.exe\n3. TicTacToe.exe\n4. Strings.exe\n\n"); |
|
|
|
scanf("%d", &choice); |
|
|
|
|
|
|
|
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; |
|
|
|
return choice; |
|
|
|
} |
|
|
|
|
|
|
|
int x_wins_00_10_20(char board[][3]) { |
|
|
@ -113,7 +87,7 @@ int o_wins_02_12_22(char board[][3]) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int string_character_counter(char string[]) { |
|
|
|
int stringCharacterCounter(char string[]) { |
|
|
|
int stringLength = 0; |
|
|
|
|
|
|
|
for (int i = 0; string[i] != '\0'; i++) { |
|
|
@ -126,7 +100,7 @@ int string_character_counter(char string[]) { |
|
|
|
int characterAppearanceInString(char c, char string[]) { |
|
|
|
int appear = 0; |
|
|
|
|
|
|
|
for (int i = 0; i < string_character_counter(string); i++) { |
|
|
|
for (int i = 0; i < stringCharacterCounter(string); i++) { |
|
|
|
if (string[i] == c) { |
|
|
|
appear++; |
|
|
|
} |
|
|
@ -135,12 +109,30 @@ int characterAppearanceInString(char c, char string[]) { |
|
|
|
return appear; |
|
|
|
} |
|
|
|
|
|
|
|
int i(int v, int r) { |
|
|
|
return v / r; |
|
|
|
int addThreeNumbers(int num1, int num2, int num3) { |
|
|
|
return num1 + num2 + num3; |
|
|
|
} |
|
|
|
|
|
|
|
int p(int f, int a) { |
|
|
|
return f / a; |
|
|
|
int multiply(int num1, int num2) { |
|
|
|
return num1 * num2; |
|
|
|
} |
|
|
|
|
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
// Function to calculate the sine of an angle in radians |
|
|
@ -347,6 +339,14 @@ float remainderValue(float x, float y) { |
|
|
|
return fmod(x, y); |
|
|
|
} |
|
|
|
|
|
|
|
float f(float m) { |
|
|
|
return m * 9.81; |
|
|
|
float calculateWeight(float mass) { |
|
|
|
return mass * 9.81; |
|
|
|
} |
|
|
|
|
|
|
|
int calculateCurrent(int voltage, int resistance) { |
|
|
|
return voltage / resistance; |
|
|
|
} |
|
|
|
|
|
|
|
int calculatePressure(int force, int area) { |
|
|
|
return force / area; |
|
|
|
} |