refactor various files

This commit is contained in:
2025-04-28 16:59:44 +02:00
parent 5049c3ec13
commit 05c830c8e2
97 changed files with 513 additions and 2676 deletions

22
S1/GdCP/uebung/code.c Normal file
View File

@@ -0,0 +1,22 @@
#include<string.h>
#include<ctype.h>
char* convert_message(const char *message, char receiver) {
char *out = strdup(message);
if (receiver != 'M' && receiver != 'L') return "Mit dir schreib ich nicht!";
int c = 0;
for (int i = 0; message[i] != '\0'; i++) {
if (isalpha(message[i])) {
if (receiver == 'M') {
if (c % 2 == 1) out[i] = toupper(message[i]);
else out[i] = tolower(message[i]);
}
else {
if (c % 2 == 0) out[i] = toupper(message[i]);
else out[i] = tolower(message[i]);
}
c++;
}
}
return out;
}