Hi , I need suggestion on how to do the following task in standard C:
I have a set of 5 cards like:
king of clubs
six of clubs
four of diamonds
six of hearts
four of hearts
I need read the 5 lines (strings) from a file, and count how many,words"six" and words "heart" I have in this set.
If I read the line with fgets, how can I discriminate the words"six" and "heart" from the whole line, for example?
I suspect pointers and the function strcmp but I dont know how to use them..
Please Can I have some indications?
Thank you for your help.
B
I have a set of 5 cards like:
king of clubs
six of clubs
four of diamonds
six of hearts
four of hearts
I need read the 5 lines (strings) from a file, and count how many,words"six" and words "heart" I have in this set.
If I read the line with fgets, how can I discriminate the words"six" and "heart" from the whole line, for example?
I suspect pointers and the function strcmp but I dont know how to use them..
Please Can I have some indications?
Thank you for your help.
B