Answered You can hire a professional tutor to get the answer.

QUESTION

C++ HELP! (CHECK REQUIREMENTS) You will make a 2D array of 13 columns and 2 rows of type char. char theArray[13][2]; will work to create the array...

C++ HELP!!! (CHECK REQUIREMENTS)

You will make a 2D array of 13 columns and 2 rows of type char. char theArray[13][2]; will work to create the array you need to store the data.

The program will process a set of commands. The commands will be described below.

load - The first command will be a load command. The load command will be followed by a file to open. That file will contain a set of characters in a 13 x 2 grid that you are to read and store in the array. The load command will always be first and it will always be followed by a filename to open. For example

load data.txt

This would mean you use another ifstream object using the file name data.txt, so store that in a variable and open that.

location - The second command is the location command. The location command will be followed by 2 integers. The integers represent an x and y location in the array. The location given by the x and y may or may not be valid. You need to make sure that they are at least 0 and less then 13 for x and 2 for y. For example:

location location - -location

The first two examples are valid and the last two are invalid.

Depending on what is stored in the first two locations you would get output like this:

0, 0: A12, 1: z

For the last two you would get this output:

13, 2: bad location

So when the location is good, you output the coordinates and then the data that is there and when the location is bad, you output the coordinates then the words "bad location". Note the comma between the x and y and the colon after the y coordinate.

Sample Input

If the input file contains this:

1data.txtlocation 12 1

And the test1data.txt contains this data:

2 Y5 R {i eK E0 =R l@ ^[ ,C pl tb {]

This is the output:

12, 1:

Requirements

You must use the file lab8.h for the header.

In the header you must declare the function void read2D_Data( string input, string output );

In your cpp file you must implement the function and use a 2D array of characters of size 13x2.

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question