Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need assistance in this program that should be written in C. Will read from a Declaration of Independence text file, which can be found through
Need assistance in this program that should be written in C. Will read from a Declaration of Independence text file, which can be found through a quick google search.
Although it should work on any input file and any substring, we'll provide a copy of an input file to use for testing (i.e "Decl of Indep.txt'). Overview Here's a high level overview of what your program should do: 1) Ask the user for the name of the input file a) If the file is not present or can't be opened, display an error message and ask the user to enter another file name. 2) Ask the user for the substring to search for. 3) Calculate and display the found occurrences of the substring in the file. For each found occurrence, your program should display (a) the location number starting at 1 and going up to the total number of locations found, and (b) the portion of the string containing the found substring. This portion should consist of the substring and 8 characters before and 8 characters after the found substring. Sample Runs Here is a sample run looking for the string "people" in the file "Decl of Indep.txt'' Looking for the substring "people" in file "Decl of Indep.txt" Location 1 for one people to String Location 2: String icts of people, unless Location 3 s tit ho see people would r String Location O f the people String Location 5 OI Ou r people StringStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started