Write a 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”. A sample grid.txt is included.
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.
Sample Runs – User input in BOLD – all row/col are zero-indexed
See the image below for an example of how the characters are counted.
Run 1:
Enter row and column:
0 0
5 cells
Run 2:
Enter row and column:
1 7
5 cells
Run 3:
Enter row and column:
3 1
11 cells
Run 4:
Enter row and column:
2 0
0 cells



Create a file with name "file.txt" and copy below content
@-@--@-@@-
@@@-@@-@--
---@------
@@-@@@-@@@
-@-@-@-@--
@@-@@@-@@-
----------
-@@@-@----
-@@@@@-@-@
-------@-@
create below file to your main cpp file
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
class Map
{
public:
Map()
{
connectedCell=0;
}
void print()
{ cout<<endl;
for(int i=0;i<10;i++)
{
for(int j=0;j<10;j++)
cout<<map[i][j]<<" ";
cout<<endl;
}
}
void input()
{
char ch;
int i=0;
fstream fin("file.txt");
string line;
while (getline(fin,line))
{
for(int j=0;j<10;j++)
map[i][j]=line.at(j);
i++;
}
fin.close();
}
int floodFill(int row, int col, char orgin, char target)
{
here is the picture of file .txt

here is the output result proof

Write a program that, given a starting location in a 2D grid of characters, will count...
Write a JAVA program to solve a sudoku! Given a partially filled 9×9 2D array ‘grid[9][9]’, the goal is to assign digits (from 1 to 9) to the empty cells so that every row, column, and subgrid of size 3×3 contains exactly one instance of the digits from 1 to 9. I have posted 3 input files: sudoku1.txt, sudoku2.txt and sudoku3.txt Problem Analysis & Design - Think about how you will need to solve this problem. You should do an...
IN C#.Develop a program that prints out the location of the largest value in a two-dimensional array. The largest values may appear more than once in the array, so you must only print out the first instance. The program defines method locateLargest() that takes a two-dimensional array of integers and returns the location (row index and column index) of the first largest value as a single-dimensional array. The program main method prompts the user to enter a 3-by-4 matrix, prints...
In the language c using the isspace() function: Write a program to count the number of words, lines, and characters in its input. A word is any sequence of non-white-space characters. Have your program continue until end-of-file. Make sure that your program works for the case of several white space characters in a row. The character count should also include white space characters. Run your program using the following three sets of input: 1. You're traveling through another...
This is for C++ Write a program that reads in a sequence of characters entered by the user and terminated by a period ('.'). Your program should allow the user to enter multiple lines of input by pressing the enter key at the end of each line. The program should print out a frequency table, sorted in decreasing order by number of occurences, listing each letter that ocurred along with the number of times it occured. All non-alphabetic characters must...
Please write a Python program to check a tic-tac-toe game and show its winning result in detail. This is an application program of a 3-dimensional list or array. Your complete test run output must look as follows. This test really checks to make sure your program is performing perfectly to check every possible winning situation for X and O. GAME 0 is as follows: OOO OOO OOO O won by row 1 O won by row 2 O won by...
You are going to be implementing the classic computer science
simulation, Conway's Game of Life.
Conway's Life is played on a matrix of cells, kind of like a
chess board but theoretically extending infinitely in every
direction. Each individual cell in the matrix can either be alive
or dead. A live cell in the matrix is shown in our simulation by
printing an asterisk (*) to the screen. A dead cell is shown by
leaving that area of the matrix...
‘C’ programming language question Write a MENU DRIVEN program to A) Count the number of vowels in the string B) Count the number of consonants in the string C) Convert the string to uppercase D) Convert the string to lowercase E) Display the current string X) Exit the program The program should start with a user prompt to enter a string, and let them type it in. Then the menu would be displayed. User may enter option in small case...
C++ Concepts: Single-Dimension Array Write a program, using 25 or fewer lines of code, to count each occurrence of each lower-case letter in a string. Start your program by declaring a character array, msg, with a size of 30 or greater. char msg[MAX]; The user should then type a text string into the array: cin.getline(msg, MAX); Your program should now report the number of each character (a-z) found in the array: a face at the beach a - 4 b...
write a code on .C file
Problem Write a C program to implement a banking application system. The program design must use a main and the below functions only. The program should use the below three text files that contain a set of lines. Sample data of these files are provided with the assessment. Note that you cannot use the library string.h to manipulate string variables. For the file operations and manipulations, you can use only the following functions: fopen(),...
Edit, compile, and run the following programs on the UNIX shell: Write a program that takes in six commandline arguments and has four functions (described below) that use bitwise operators. The user should enter six space-separated commandline arguments: four characters (any ASCII character) followed by two integers. Anything else should print an error message telling the user what the correct input is and end the program. Convert the commandline input into "unsigned char" and "unsigned int" datatypes. Be careful with...