Question: Write a C++ program that, given a starting location in a 2D grid of characters, will count how many contiguously connected @ symbols there are.

Write a C++ program that, given a starting location in a 2D grid of characters, will count how many contiguously connected @ symbols there are. Cells have to be direct neighbors either horizontally or vertically to count as contiguous. However, the right/left and top/bottom edges ARE considered to be connected you can wrap around from one side of the matrix to the opposite one.

The grid of chars will always be 10x10. Your program should load the grid of chars from a file called grid.txt.

Your program MUST make use of a recursive function for the core problem. You may use loops to read in the data from the file.

Do NOT use a global variable to keep track of the count.

Write a C++ program that, given a starting location in a 2D

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!