Question
Write a recursive C++ program that lets you enter a both a file and a word. This recursive function should count how many lines of
Write a recursive C++ program that lets you enter a both a file and a word. This recursive function should count how many lines of the file contain the said word. You can get all your variables/objects setup in main before you use your recursive function. (Hint: Like you could put the file into an array or string.) You can assume there will not be more than 500 lines in the file.
Note: By line contains, I mean does the word appear anywhere on the line, even as part of another word. So in Example 1, when looking for the word one, words like someone should count as those three letters appear exactly as shown, despite them being part of a larger word. Example 1 (user input is underlined): What file? words.txt What word? one Number of lines with the word: one .
Example 1 (user input in bold): What file?
words.txt
What word?
one
Number of lines with the word: one
5
Example 2
(user input in bold):
What file?
words.txt
What word?
are
Number of lines with the word: are
8
file content:
Dear Nick, You really make my day. Your sweet voice reverberates in my heart. Your shoes are so cool and SO BLUE! And your pants are blue too, and your water bottle! You are just a blue suede dude! To top it off, you're a super smart guy. Doing both math and CSci! Always on time for work. And you're not a jerk! If I were to summarize Prof. James E Parker's wily cajoleries I'd need only one word: frowsy. In the text that follows we will dissect and examine Prof. Parker's denunciations and leave the conclusion, with no tipping of the scales, to the logic of the facts. We begin with the observation that Prof. Parker is completely gung-ho about gangsterism because he lacks more pressing soapbox issues. We mustn't be content to patch and darn, to piece and cobble at the worn and rotten fabric of his perfidious taradiddles. Instead we must banish intolerance. There is more at play here than Prof. Parker's purely political game of creating an intimidating, hostile, and demeaning environment. There are ideologies at work, hidden agendas to undermine the individualistic underpinnings of traditional jurisprudence. Prof. Parker says that he can scare us by using big words like a?incomprehensibilitya . The inference is that anyone who disagrees with Prof. Parker is a potential terrorist. I'm happy to report that I can't follow that logic. Although the seeds of cuckoo racialism were sown long before his rise to power, there is only one way to stop Prof. Parker from destroying the natural beauty of our parks and forests. We must make out of fools, wise people; out of fanatics, men of sense; out of idlers, workers; out of improvident, depraved troublemakers, people who are willing to pursue virtue and knowledge. Then together we can build a society in which people have a sense of permanence and stability, not chaos and uncertainty. Together we can show the world that a?Prof. Parkera has now become part of my vocabulary. Whenever I see someone playing on people's irrational fears, I tell him or her to stop a?Prof. Parker-inga . That's not the most frightening thing about Prof. Parker. Have you heard that he likes to have difficult social issues presented to him in simple, black-and-white terms? I, speaking as someone who is not an incomprehensible heresiarch, find information like that disturbing on so many levels that I can't help but want to encourage the ethos of exchange value over use value. Sure, some of his false-flag operations are valid but that's not the point. And if you think that it is his moral imperative to sow the seeds of discord, then you aren't thinking very clearly. Prof. Parker has made it known that he fully intends to engulf reason and humanity within waves of rowdyism and fear. If those words don't scare you, nothing will. If they are not a clear warning, I don't know what could be. Anyway, I hope I've made my point, which is that objective consideration of Prof. James E Parker's abrasive teachings compels the conclusion that we might be able to explain away many of his fastuous credos as being merely the effect of bad drugsDear Nick, You really make my day. Your sweet voice reverberates in my heart. Your shoes are so cool and SO BLUE! And your pants are blue too, and your water bottle! You are just a blue suede dude! To top it off, you're a super smart guy. Doing both math and CSci! Always on time for work. And you're not a jerk! If I were to summarize Prof. James E Parker's wily cajoleries I'd need only one word: frowsy. In the text that follows we will dissect and examine Prof. Parker's denunciations and leave the conclusion, with no tipping of the scales, to the logic of the facts. We begin with the observation that Prof. Parker is completely gung-ho about gangsterism because he lacks more pressing soapbox issues. We mustn't be content to patch and darn, to piece and cobble at the worn and rotten fabric of his perfidious taradiddles. Instead we must banish intolerance. There is more at play here than Prof. Parker's purely political game of creating an intimidating, hostile, and demeaning environment. There are ideologies at work, hidden agendas to undermine the individualistic underpinnings of traditional jurisprudence. Prof. Parker says that he can scare us by using big words like a?incomprehensibilitya . The inference is that anyone who disagrees with Prof. Parker is a potential terrorist. I'm happy to report that I can't follow that logic. Although the seeds of cuckoo racialism were sown long before his rise to power, there is only one way to stop Prof. Parker from destroying the natural beauty of our parks and forests. We must make out of fools, wise people; out of fanatics, men of sense; out of idlers, workers; out of improvident, depraved troublemakers, people who are willing to pursue virtue and knowledge. Then together we can build a society in which people have a sense of permanence and stability, not chaos and uncertainty. Together we can show the world that a?Prof. Parkera has now become part of my vocabulary. Whenever I see someone playing on people's irrational fears, I tell him or her to stop a?Prof. Parker-inga . That's not the most frightening thing about Prof. Parker. Have you heard that he likes to have difficult social issues presented to him in simple, black-and-white terms? I, speaking as someone who is not an incomprehensible heresiarch, find information like that disturbing on so many levels that I can't help but want to encourage the ethos of exchange value over use value. Sure, some of his false-flag operations are valid but that's not the point. And if you think that it is his moral imperative to sow the seeds of discord, then you aren't thinking very clearly. Prof. Parker has made it known that he fully intends to engulf reason and humanity within waves of rowdyism and fear. If those words don't scare you, nothing will. If they are not a clear warning, I don't know what could be. Anyway, I hope I've made my point, which is that objective consideration of Prof. James E Parker's abrasive teachings compels the conclusion that we might be able to explain away many of his fastuous credos as being merely the effect of bad drugs
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