Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PROGRAMMING LANGUAGE IS C. Please help, I can't figure this out. C Elementary Linear Algebra ?n m EE3341 Hw 8 -String ProcessingX elearning utdallas.edu/bbcswebdav/pid-1831467-dt-content-rid-3551 1636
PROGRAMMING LANGUAGE IS C. Please help, I can't figure this out.
C Elementary Linear Algebra ?n m EE3341 Hw 8 -String ProcessingX elearning utdallas.edu/bbcswebdav/pid-1831467-dt-content-rid-3551 1636 1/courses/2182 UTDAL-CS-1325-SEC001-23218/HW%208%20- %20String%20Processing%28 BryteWave.com-Digital le. Mall-axg166530@utdallas, Arslan Secure https ? HW 8-String Processing(1).pdf 3 15 Program 2 - Detecting Substrin A very common task that is often performed by programs that work with text files is the problem of locating a specific substring within the file. I'm sure we've all done this many times in working with Word, Notepad, or other editors. Since we don't have a GUI or other means of displaying the contents of a file all at once, let's modify the problem slightly. Rather than locating a specific substring within a file and then highlighting the results, as most modern programs would do, let's write a C program that locates the occurrences of a specific substring within a file and then displays the occurrence number as well as a portion of the text around the found substring. It should also count the number of occurrences and indicate that number in a brief report at the end. Although it should work on any input file and any substring, we'll provide a copy of an input file to use for tes.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) display an error message and ask the If the file user to enter another file name is not present or can't be opened, 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. (Note that if the substring is within 8 characters of the end of a line this won't be possible.) 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
Step 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