Question: 26. (8 pts) Finish, using a while loop, the code segment below so that the following actions are performed a) Prompt the user for the


26. (8 pts) Finish, using a while loop, the code segment below so that the following actions are performed a) Prompt the user for the name of an input file and read it. b) Open the file c) While the file does not open successfully, print out a message stating as such, reset the input stream variable (code to do this is inFile.clear):) d) Repeat steps a,b,c until a file is successfully opened or the user enters ctrl-c. ifstream inFile; string filename; cout > filename; inFile.open (filename. c str)) // rest of the code segment goes below this line
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
