Reference no: EM132167157
Using C++,
Write a program that asks the user for a file name and a string to search for. The program should search the file for every occurrence of a specified string.
When the string is found, the line that contains it should be displayed. After all the occurrences have been located, the program should report the number of times the string appeared in the file.
You can have any content in the input file.
The law provides subsidies to low- and moderate-income Americans to help them afford premiums. Those with lower incomes can receive additional subsidies to reduce their premiums and deductibles.
Republicans want to repeal the Obamacare taxes and provide tax credits based on age, not income, so all those buying policies in the individual market would get some assistance. These subsidies, however, likely wouldn't be as generous for older Americans and lower-income folks.
Sample Run Enter the file name: input.txt Enter string to search for: subsidies found in: The law provides subsidies to low- and found in: Those with lower incomes can receive additional subsidies found in: These subsidies, however, likely wouldn't be as generous "subsidies" was found 3 times.