Write a program that will accept a text file and echoes all of the words to the terminal and places a single space character between consecutive words. Words are composed of alphabetic characters only. Your program should write only five words on each lin, separating words on a line by blanks. The box below on the left shows sample input and the box on the right shows the corresponding correct output.

Ex. It is true that there are many fishes in the ocean. But there is only one fish meant for you !

the output must be :

It is true that there
are many fishes in the
ocean. But there is only
one fish meant for you !

Recommended Answers

All 4 Replies

We don't do homework assignments for people. You need to make the effort to write this program. Then, we might be able to make suggestions to help you understand your mistakes and what to do next.

no sir.. i need only ideas,suggestions or tips if how to start to make this program.. coz im only 1st yr college student in philippines.. hope you understand sir..

Can you read in a text file?

Can you count the number of words in a string?

Start by gathering some of the pieces that you can do together, and try to integrate them into one whole program.

coz im only 1st yr college student

All the more reason for you to take responsibility for completing your assignment.

no sir.. i need only ideas,suggestions or tips if how to start to make this program.. coz im only 1st yr college student in philippines.. hope you understand sir..

There goes a "suggestion"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.