1. Examine the following program. Identify and correct any errors. #include int main() { ifstream in_file; in_file.open(input.dat); cout << "File opened" << endl; return 0; } 2. Write the statement required to explicitly close a file. Assume that the physical file name is output.dat and the stream is out_file. 3. Examine the following program. You have been asked to modify this program so that the output is directed to the screen instead of the output file. Make all necessary changes. #include int main() { ifstream in_file; ofstream out_file; in_file.open("input.dat"); out_file.open("output.dat"); int num1, num2, num3; in_file >> num1 >> num2 >> num3; out_file << "first " << num1 << " second " << num2 << " third " << num3 << endl; in_file.close(); out_file.close(); return 0; } 4. You are writing a program that must copy the contents of a specified file to the screen. Write the code necessary to prompt the user for the file name and to get the name supplied. If necessary, assume the input stream has been declared as in_file. 5. Examine the following program. This program has been proposed as a program to copy the contents of a file containing integers. Examine the program carefully and comment on the contents of the output file assuming the input file contents below (i.e. following the program). #include int main() { ifstream in_file; ofstream out_file; in_file.open("input.dat"); out_file.open("output.dat"); int num1; while (in_file >> num1) out_file << num1; in_file.close(); out_file.close(); return 0; } 10 20 30 40 1 15 31 6. Examine the following code fragment. What do you think would be output if the input file contains the characters below: abc.xyz char ch; do { in_file.get(ch); cout << toupper(ch); } while (ch != '.'); Hint: See page 864 of your text.