Compare commits
No commits in common. "50d0fcdb6ddb8f086cc1f023451bfb709eb69c30" and "f98e5f71337a73331734d4840a9e1e08214b7cc3" have entirely different histories.
50d0fcdb6d
...
f98e5f7133
9
farben.c
9
farben.c
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
// Vergleich zweier Strings ohne Beachtung der Groß-/Kleinschreibung
|
// Vergleich zweier Strings ohne Beachtung der Groß-/Kleinschreibung
|
||||||
int string_equals_ignore_case(const char *a, const char *b) {
|
int string_equals_ignore_case(const char *a, const char *b) {
|
||||||
while (*a && *b) { //läuft so lange bis sie nicht das Ende erreicht haben
|
while (*a && *b) {
|
||||||
if (tolower((unsigned char)*a) != tolower((unsigned char)*b)) { // jedes Zeichen wird in Kleinbuchstaben umgewandelt um beide strings besser zu vergleichen
|
if (tolower((unsigned char)*a) != tolower((unsigned char)*b)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
a++;
|
a++;
|
||||||
@ -49,12 +49,12 @@ int main() {
|
|||||||
char user_colors[2][20]; // Platz für 2 Farben
|
char user_colors[2][20]; // Platz für 2 Farben
|
||||||
int attempts = 0;
|
int attempts = 0;
|
||||||
|
|
||||||
while (attempts < 2) { // läuft so lange bis man zwei gültige Farben eingegeben hat
|
while (attempts < 2) {
|
||||||
printf("Bitte gib eine Grundfarbe (Rot, Gruen oder Violett) ein: ");
|
printf("Bitte gib eine Grundfarbe (Rot, Gruen oder Violett) ein: ");
|
||||||
scanf("%19s", user_colors[attempts]);
|
scanf("%19s", user_colors[attempts]);
|
||||||
while (getchar() != '\n'); // Eingabepuffer leeren
|
while (getchar() != '\n'); // Eingabepuffer leeren
|
||||||
|
|
||||||
if (is_valid_color(user_colors[attempts])) { // überprüft ob die eingegeben Farbe gültig ist
|
if (is_valid_color(user_colors[attempts])) {
|
||||||
printf("Du hast %s gewaehlt.\n", user_colors[attempts]);
|
printf("Du hast %s gewaehlt.\n", user_colors[attempts]);
|
||||||
attempts++;
|
attempts++;
|
||||||
} else {
|
} else {
|
||||||
@ -62,7 +62,6 @@ int main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Berechnen der Mischfarbe und Ausgabe der Farbe
|
|
||||||
printf("Die Mischfarbe ist dann: %s\n", mix_colors(user_colors[0], user_colors[1]));
|
printf("Die Mischfarbe ist dann: %s\n", mix_colors(user_colors[0], user_colors[1]));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
BIN
wochentag.exe
BIN
wochentag.exe
Binary file not shown.
BIN
wortlen.exe
BIN
wortlen.exe
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user