Question: The Problem: You'll find a poem I've been working on for the past several months attached to this announcement as input.txt. It reads as follows:

The Problem:

You'll find a poem I've been working on for the past several months attached to this announcement as "input.txt". It reads as follows:

red orange yellow green magenta blue indigo violet

What I'd like for you to do for me is download input.txt and write a program that accomplishes the following:

1. Create a new file called output.txt. This is where your output will be written to.

2. Give my poem a title. This should be the first line written to output.txt, and it can be whatever you'd like.

3. Read the contents of input.txt into a buffer, one line at a time. Print them out to the console and then write them to output.txt.

4. Correct the mistake in my poem! If you look closely, you'll notice that my poem draws heavily from the colors of the rainbow. Magenta is not one of these colors, so make sure that it does not get written to output.txt (hint: you'll probably want to handle this using a conditional and strcmp() when you write to output.txt).

5. Give my poem a closing line to tie everything together. Again, this can be whatever you'd like.

Sample Output:

Your output.txt file should look something like this:

a poem by bob smith red orange yellow green blue indigo violet these are the colors of the rainbow.

Notice the title, omission of the word magenta, and the closing line at the end of the poem.

Please use file i/o and the c language!!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!