Given the following code: #include using namespace std; // global variables const int ROWS = 10, COLS = 10; int main() { char a[ROWS][COLS] = { { ' ', ' ', ' ', ' ', 'B', 'B', ' ', ' ', ' ', ' '} , { ' ', ' ', ' ', 'B', ' ', ' ', 'B', ' ', ' ', ' '}, { ' ', ' ', 'B', ' ', ' ', ' ', ' ', 'B', ' ', ' '}, { ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' '}, { 'B', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B'}, { 'B', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B'}, { ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' '}, { ' ', ' ', 'B', ' ', ' ', ' ', ' ', 'B', ' ', ' '}, { ' ', ' ', ' ', 'B', ' ', ' ', 'B', ' ', ' ', ' '}, { ' ', ' ', ' ', ' ', 'B', 'B', ' ', ' ', ' ', ' '} }; printArray( a, ROWS, COLS ); fillInside( a, ROWS, COLS, 'x' ); // Use the first letter of your first name printArray( a, ROWS, COLS ); fillInside( a, ROWS, COLS, ' ' ); fillOutside( a, ROWS, COLS, 'y' ); // Use the first letter of your last name printArray( a, ROWS, COLS ); return 0; } Write the functions: NOTE you may change the functions and main code if you wish printArray() fillInside() fillOutside() Your output should look as follows: B B B B B B B B B B B B B B B B B B B B B B B x x B B x x x x B B x x x x x x B B x x x x x x x x B B x x x x x x x x B B x x x x x x B B x x x x B B x x B B B y y y y B B y y y y y y y B B y y y y y B B y y y B B y B B B B y B B y y y B B y y y y y B B y y y y y y y B B y y y y
Given the following code:
#include <iostream>
using namespace std;
// global variables
const int ROWS = 10, COLS = 10;
int main()
{
char a[ROWS][COLS] = {
{ ' ', ' ', ' ', ' ', 'B', 'B', ' ', ' ', ' ', ' '} ,
{ ' ', ' ', ' ', 'B', ' ', ' ', 'B', ' ', ' ', ' '},
{ ' ', ' ', 'B', ' ', ' ', ' ', ' ', 'B', ' ', ' '},
{ ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' '},
{ 'B', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B'},
{ 'B', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'B'},
{ ' ', 'B', ' ', ' ', ' ', ' ', ' ', ' ', 'B', ' '},
{ ' ', ' ', 'B', ' ', ' ', ' ', ' ', 'B', ' ', ' '},
{ ' ', ' ', ' ', 'B', ' ', ' ', 'B', ' ', ' ', ' '},
{ ' ', ' ', ' ', ' ', 'B', 'B', ' ', ' ', ' ', ' '} };
printArray( a, ROWS, COLS );
fillInside( a, ROWS, COLS, 'x' ); // Use the first letter of your first name
printArray( a, ROWS, COLS );
fillInside( a, ROWS, COLS, ' ' );
fillOutside( a, ROWS, COLS, 'y' ); // Use the first letter of your last name
printArray( a, ROWS, COLS );
return 0;
}
Write the functions: NOTE you may change the functions and main code if you wish
printArray()
fillInside()
fillOutside()
Your output should look as follows:
B B
B B
B B
B B
B B
B B
B B
B B
B B
B B
B B
B x x B
B x x x x B
B x x x x x x B
B x x x x x x x x B
B x x x x x x x x B
B x x x x x x B
B x x x x B
B x x B
B B
y y y y B B y y y y
y y y B B y y y
y y B B y y
y B B y
B B
B B
y B B y
y y B B y y
y y y B B y y y
y y y y B B y y y y
Step by step
Solved in 3 steps with 4 images