a. Write a program to search for the number of times a word appears in a text file. The search word should be input for the keyboard. The searching should be performed in a function and return a Boolean to represent either 'found' or 'not found'. You should use the standard comparison C function strcmp() or strcmp_s().
b. Add a new function to detect the number of times a word, input from the keyboard, appears in the file BUT you should write your own word comparison function using ONLY pointers (not array indexes) - name your function mystrcmp(). DO NOT use the standard C comparison function as in a above, you MUST write your own function to check character by character using pointers.
c.Add a function to create a new output file with all occurrences of the search word removed from the original file, do not copy the found search word to the output file. You should make use of the function you have written for part b. The function should return the number of words in the original file and in the new file. Print a message from the main program stating the words in the original file and the number of words copied to the output file.
d. Modify the program so that it can be executed from the command line. The word to be search for should be entered from the command line along with the name of the file to be searched. - you will need to research how to do this in Visual studio if not covered in the lectures.
e. Advanced feature. Modify the program to use command line switches, you may include other switches if required:
-t to display the number of times the search word is found
-r to remove the word from the original file
-d to display the number of words in the original and new file
Your output should take the form as shown below:
Programming Task 2
Part a
Using standard string compare function.
Search word is 'window'
Search word found after 15 words in file
Search word found after 21 words in file
Search word found 2 times in file.
Part b.
Using my string compare function using pointers
Search word is 'door'
Search word found after 8 words in file
Search word found 1 times in file.
Part c.
Removing search word from a file
Search word is 'roof'
Search word found after 3 words in file and not copied to the output file.
Search word found after 14 words in file and not copied to the output file.
Number of words in the original file is 32
Number of words copied to the output file is 30
Parts d and e
you will need to demonstrate to your tutor and produce suitable output here.