2 Commits
Author SHA1 Message Date
dunkellu103850 bc80769399 Mein aktuelles Programm. 2026-10-28 10:48:03 +01:00
dunkellu103850 9f0c315134 Mein fertiger Input. 2026-10-28 09:36:11 +01:00
3 changed files with 49 additions and 5 deletions

No files matched your search

File renamed without changes.
+35 -1
View File
@@ -8,5 +8,39 @@
// Read words from file and store in 'words' array // Read words from file and store in 'words' array
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
{ {
int c = 0;
int count = 0;
int letterCount = 0;
while (count < maxWordCount)
{
while ((c = fgetc(file)) != EOF) //Leerzeichen prüfen
{
if (isspace(c) || !isalpha(c)) {
if (letterCount > 0) {
break; //Wort fertig eingelesen
}
}dhckhdkfhdjf continue; // mehrere Leerzeichen oder Sonderzeichen überspringen
}
if (letterCount < MAX_WORD_LEN - 1) //wörter Buchstabenweise einlesen
{
words[count][letterCount] = (char)toupper(c);
letterCount++;
}
}
if (letterCount == 0) {
break; //kein weiteres Wort gefunden
}
words[count][letterCount] = '\0';
letterCount = 0;
count++;
if (c == EOF) {
break;
}
}
return count;
}
+14 -4
View File
@@ -1,5 +1,15 @@
Yeti,Nessie Werwolf; Vampir Yeti
Nessie
Werwolf
Vampir
Monster Monster
Hydra;Frankenstein Hydra
Dracula;KingKong;Gremlin;Kobold,Hexe;Poltergeist Frankenstein
Gespenst, Oger Dracula
KingKong
Gremlin
Kobold
Hexe
Poltergeist
Gespenst
Oger