- #1
brad sue
- 281
- 0
Hi , I need suggestion on how to do the following in C (ANSI):
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,"six" and "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 don't 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,"six" and "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 don't know how to use them..
Please Can I have some indications?
Thank you for your help.
B