2082 11

BIT153 ยท 2082 ยท 5 marks

Write a C++ program to read a text file named data.txt and display its contents on the screen. Also, count the number of lines, words, and characters in the file and display these counts after showing the file content.

Write a C++ program to read a text file named data.txt and display its contents on the screen. Also, count the number of lines, words, and characters in the file and display these counts after showing the file content. [5]

Object Oriented ProgrammingChapter 10: Exception Handling and File I/OText file reading and writing

Suppose data.txt contains: Program Output: Concept Description ------ ifstream Used to open and read from a file getline() Reads one complete line at a time inFile check Verifies file was opened successfully line.length() Returns number of characters in a line Word counting Detects transition fro...