|
|
@ -6,27 +6,27 @@ |
|
|
|
|
|
|
|
|
|
|
|
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; |
|
|
|
return choice; |
|
|
|
} |
|
|
|
|
|
|
|
int addThreeNumbers(int a, int b, int c) { |
|
|
|
return a + b + c; |
|
|
|
int addThreeNumbers(int num1, int num2, int num3) { |
|
|
|
return num1 + num2 + num3; |
|
|
|
} |
|
|
|
|
|
|
|
int multiply(int h, int g) { |
|
|
|
return h * g; |
|
|
|
int multiply(int num1, int num2) { |
|
|
|
return num1 * num2; |
|
|
|
} |
|
|
|
|
|
|
|
int subtract(int num1, int num2) { |
|
|
@ -95,7 +95,7 @@ int x_wins_02_11_20(char board[][3]) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int string_character_counter(char string[]) { |
|
|
|
int stringCharacterCounter(char string[]) { |
|
|
|
int stringLength = 0; |
|
|
|
|
|
|
|
for (int i = 0; string[i] != '\0'; i++) { |
|
|
@ -108,7 +108,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++; |
|
|
|
} |
|
|
@ -117,12 +117,12 @@ int characterAppearanceInString(char c, char string[]) { |
|
|
|
return appear; |
|
|
|
} |
|
|
|
|
|
|
|
int i(int v, int r) { |
|
|
|
return v / r; |
|
|
|
int calculateCurrent(int voltage, int resistance) { |
|
|
|
return voltage / resistance; |
|
|
|
} |
|
|
|
|
|
|
|
int p(int f, int a) { |
|
|
|
return f / a; |
|
|
|
int calculatePressure(int force, int area) { |
|
|
|
return force / area; |
|
|
|
} |
|
|
|
|
|
|
|
// Function to calculate the sine of an angle in radians |
|
|
@ -331,4 +331,8 @@ float remainderValue(float x, float y) { |
|
|
|
|
|
|
|
float f(float m) { |
|
|
|
return m * 9.81; |
|
|
|
} |
|
|
|
|
|
|
|
float calculateWeight(float mass) { |
|
|
|
return mass * 9.81; |
|
|
|
} |