Question: Write a C+program called coin collection.cpp to collect maximum number of coins on an n x m board with inaccessible cells. For details, read the

Write a C+program called coin collection.cpp to collect maximum number of coins on an n x m board with inaccessible cells. For details, read the question 5 of the textbook page 291 Your program should ask a user for a text filename to read a 2-D array of a sequence of numbers. In the array, 1 indicates that there's a coin on the cell, while 0 means no coin. A cell with the number 2 indicates that the cell is not accessible. Your program should display maximum possible coins and path to collect it. If you have more than one path, you only need to display one. For the homework, you can assume that the board size is less than or equal to 25 x 25. When you write the program, don't forget to include "Title", "Abstract", "ID (A four-digit number)", "Name", and "Date" This is a sample run of the program on the cloud9 S g++o coin_collection.cpp Enter a file name: ./tl.txt Max coins: 3 Path: (1,1)-2,1)->(2,2)-(3,2)->(3,3)->(4,3)-(4,4) For the sample run, t1.txt has the following context: 0 2 11 0 1 2 1 0 0 1 2 1 2 0 1 The first line (-4 and 4 in the example) indicates the numbers of rows and columns in the file. One blank spac program does not read the file properly, your program will get no credit. In the sample execution, the starting indexes of the path are 1, not 0. e is used to delimiter the data. Note that there's no blan k space at the end of each line. If your This is another sample run. $ g+t -o coin collection coin_collection.cpp Enter a file name: /t2.txt Max coins: 1 Path: (1,1)-211,2)->(1,3)-(1,4)-(2,4) Write a C+program called coin collection.cpp to collect maximum number of coins on an n x m board with inaccessible cells. For details, read the question 5 of the textbook page 291 Your program should ask a user for a text filename to read a 2-D array of a sequence of numbers. In the array, 1 indicates that there's a coin on the cell, while 0 means no coin. A cell with the number 2 indicates that the cell is not accessible. Your program should display maximum possible coins and path to collect it. If you have more than one path, you only need to display one. For the homework, you can assume that the board size is less than or equal to 25 x 25. When you write the program, don't forget to include "Title", "Abstract", "ID (A four-digit number)", "Name", and "Date" This is a sample run of the program on the cloud9 S g++o coin_collection.cpp Enter a file name: ./tl.txt Max coins: 3 Path: (1,1)-2,1)->(2,2)-(3,2)->(3,3)->(4,3)-(4,4) For the sample run, t1.txt has the following context: 0 2 11 0 1 2 1 0 0 1 2 1 2 0 1 The first line (-4 and 4 in the example) indicates the numbers of rows and columns in the file. One blank spac program does not read the file properly, your program will get no credit. In the sample execution, the starting indexes of the path are 1, not 0. e is used to delimiter the data. Note that there's no blan k space at the end of each line. If your This is another sample run. $ g+t -o coin collection coin_collection.cpp Enter a file name: /t2.txt Max coins: 1 Path: (1,1)-211,2)->(1,3)-(1,4)-(2,4)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
