Question: Lab Task 2 Text File Input of Doom (An exercise in file processing) Textbook Reference: Chapter 12 Your boss at Mazes for Mice has decided
| Lab Task 2 Text File Input of Doom |
| (An exercise in file processing) |
| Textbook Reference:
|
Your boss at Mazes for Mice has decided that having to input the maze data via the keyboard is far too slow, especially for companies (such as the one in which Microsofts employees work) that use large mazes.
Instructions:
Open a new Visual Studio project. Open a new C++ source file. Write a program that inputs the data below from a text file and then outputs it to the screen. Remember to #include
Input: (just use Notepad to create this file and remember to include the zero (0) ).
# # # #
# M # #
# . . #
# # . #
# . . #
# # # #
0
Output you should get:
# # # #
# M # #
# . . #
# # . #
# . . #
# # # #
When the program works, simply initial the Task 2 space on the cover sheet.
| Lab Task 3 Text File Input/Output of Doom |
| (An exercise in file processing) |
| Textbook Reference:
|
Your boss at Mazes for Mice has decided that having to output the maze data to the screen is way too costly. You are now to output to a separate text file instead of the screen. Remember you can do this by declaring your ofstream object and then using it like you do ifstream objects, but with the redirection arrows (<<).
Instructions:
Open a new Visual Studio project. Open a new C++ source file. Write a program that inputs the data below from a text file (use the same file you did in Task #2) and then outputs it to a second text file. Remember to #include
The input will terminate when it reaches a zero (0), but it will not display this character. You may assume the maze will be no larger than 10x10.
Input: (just use the input file from task 2 and remember to include the zero (0).
# # # #
# M # #
# . . #
# # . #
# . . #
# # # #
0
Output you should get:
# # # #
# M # #
# . . #
# # . #
# . . #
# # # #
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
