0
Error at comparing Input from text file
Input word doesn't compare from the words listed in the text file and show the output https://code.sololearn.com/cxsuT3us9iZI/?ref=app Example: . TXT FILE Tango, Foxtrot Bravo, Alpha Charlie, Delta India, Romeo Whiskey, Victor Etc. Etc. Input: Charlie Output: Charlie, Delta or Delta
1 Réponse
0
The way it sounds, you can just use strstr() to search for the input word in the current line:
https://en.cppreference.com/w/c/string/byte/strstr
Printing the word to the right is a bit more complex, but certainly manageable with various string functions likr strcpy().
Also, I don't understand what the for-loop was for, or why you suddenly used "Tword" without initializing it before?
Anyway, a full example could look like this (adopted for SL):
https://code.sololearn.com/c6n9tinUjDT1/?ref=app