Write a program that reads in the name of a file and prints out the number of ch
ID: 3564740 • Letter: W
Question
Write a program that reads in the name of a file and prints out the number of characters, words, and lines in the document. Include the end-of-line character in the number of characters. A word is any sequence of characters that is delineated by a space or end-of-line character.
Suppose the file td.txt contains the following data. There is no end-of-line character in the fourth line.
abcd efgh ijkl
mn op qrst uv
wx y z 0 1 23
45 67 89
The program works as follows:
Enter document name: td.txt
4 16 51
Explanation / Answer
print num_lines
print num_chards
print num_words
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.