Question: In Class Assignment Ch . 1 3 ( C + + ) - Write a program that asks the user for the name of a

In Class Assignment Ch.13(C++)
- Write a program that asks the user for the name of a text file. The program should display the first 10 lines of the file on the screen. If the file has fewer than 10 lines, the entire file should be displayed along with a message indicating the entire file has been displayed.
- Create your own text file. Test the program with the file having 10 lines, 10+ lines, and less than 10 lines.
- Do error checking on the file "open" to make sure it opened correctly. Test file for file error (not found or incorrect name).
- NOTE: To use a variable "filename" entered by the user, open as follows:
fstream infile (filename.data()) or
fstream infile (filename.c_str())
In Class Assignment Ch . 1 3 ( C + + ) - Write a

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 Programming Questions!