Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Inputs: An input file named sentences that contains a sequence of sentences. The number of sentences as well as the length of each sentence may

Inputs: An input file named "sentences" that contains a sequence of sentences. The number of sentences as well as the length of each sentence may be arbitrarily long. There are no whitespace constraints - for example, two sentences may have multiple spaces between them, a sentence may or may not start on its own line, etc. However, you may assume that the characters in the sentences are all ASCII (so, no need to handle special Unicode characters).

An input file named "words" that contains a sequence of words, one per line. Words may be of arbitrary length but a precondition to main is that there are between 2 and 8 words in this file. inputs contain no non-printable ASCII characters (so you don't need to test for that).

How can i write a program that produces the following outputs:

An output file named "match" that contains every sentence with the first word in file "words". Each sentence should be on its own line. An output file named "replace" that contains the same data as above, but with every occurrence of the first word of "words" replaced with the second word of "words".

An output file named "allwords" that contains every sentence with each of the words in file "words" (not necessarily contiguous or in the same order). Each sentence should be on its own line and in the same order as in the sentences file.

Output messages to the screen in the following order (and using this exact text):: sentences that match the first word saved in file match. The longest sentence matching the first word has words, and the 2nd longest has words. sentences that match every word saved in file allwords. Note that you should handle the case where the two longest sentences are of the same length (unlike similar code we gave in class). If there are any errors (including cases of missing files, etc.), output appropriate messages to cerr. There are some additional rules that apply to all outputs: All matches are case-insensitive - for example, the word "ate" is considered to match sentence "I aTe pizza". Sentences in the output files should start in an upper case character (whether or not the input sentence did), but should preserve case otherwise. how can i code this without using anything beyond functions and strings

No Array and Vector using c++

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

2. How were various roles filled?

Answered: 1 week ago

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago