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