Write a C program that defines the 5 times 5 grid shown belo

Write a C++ program that defines the 5 times 5 grid shown below. The program should then call a method to display the grid. The output should look like this: char board[5][5] =

Solution

#include <iostream>
using namespace std;
void display(char board[][5])
{
   for(int i=0;i<5;i++)
   {
       for(int j=0;j<5;j++)
       {
           cout<<board[i][j]<<\' \';
       }
       cout<<endl;
   }
}
int main()
{
   char board[5][5] = {{\'.\',\'.\',\'.\',\'.\',\'.\'},
                       {\'.\',\'*\',\'*\',\'*\',\'.\'},
                       {\'*\',\'*\',\'*\',\'.\',\'.\'},
                       {\'.\',\'.\',\'.\',\'.\',\'.\'},
                       {\'.\',\'.\',\'.\',\'.\',\'.\'}};
   display(board);
   return 0;
}

 Write a C++ program that defines the 5 times 5 grid shown below. The program should then call a method to display the grid. The output should look like this: c

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site