Question: In Class Assignment Ch . 1 3 ( C + + ) - Write a program that asks the user for the name of a
In Class Assignment ChC
Write a program that asks the user for the name of a text file. The program should display the first lines of the file on the screen. If the file has fewer than 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 lines, lines, and less than 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 filenamedata or
fstream infile filenamecstr
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
