generated from freudenreichan/info2Praktikum-Wortsalat
testphrases deleted + all test for input passed
This commit is contained in:
parent
c18b6a4529
commit
a78c1e2ea2
Binary file not shown.
@ -8,14 +8,12 @@
|
||||
// Read words from file and store in 'words' array
|
||||
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||
{
|
||||
puts("....");
|
||||
char puffer[MAX_LINE_LEN]; //Array für eingelesene Zeile
|
||||
int counter = 0; //Zähler für Anzahl eingelesener Wörter
|
||||
int i;
|
||||
|
||||
while(fgets(puffer, MAX_LINE_LEN-1, file) != NULL && counter < maxWordCount)
|
||||
{
|
||||
puts(".!!!!!");
|
||||
char *word_parts = strtok(puffer, ",;\n\t/. "); //Wörter aufteilen
|
||||
|
||||
while(word_parts != NULL && counter < maxWordCount)
|
||||
@ -28,33 +26,10 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||
for(i = 0; words[counter][i] != '\0'; i++)
|
||||
{
|
||||
words[counter][i] = toupper(words[counter][i]);
|
||||
printf("%c",words[counter][i]);
|
||||
}
|
||||
|
||||
for(int z = 0; z < maxWordCount; z++)
|
||||
{
|
||||
for(int o = 0; o < MAX_WORD_LEN; o++)
|
||||
{
|
||||
printf("%c", words[z][o]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/*
|
||||
for(i = 0; i < MAX_WORD_LEN -1; i++) //MAX = 100
|
||||
{
|
||||
words[counter][i] = toupper(word_parts[i]); //Großbuchstaben erzeugen
|
||||
puts("?????????????????");
|
||||
printf("%c", word_parts[i]);
|
||||
if(word_parts[i+1] == '\0')
|
||||
break;
|
||||
}
|
||||
words[counter][i] = '\0'; //Stringdefinition vervollständigen
|
||||
*/
|
||||
counter++; // Wort eingelesen, Wortzähler erhöhen
|
||||
word_parts = strtok(NULL, ",;\n\t/. "); //NULL für Zeiger angeben
|
||||
}
|
||||
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
Hund,Katze; Maus
|
||||
@ -1,3 +0,0 @@
|
||||
Apfel
|
||||
Banane
|
||||
Kiwi
|
||||
Loading…
x
Reference in New Issue
Block a user