Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Input: grid[][] = { axmy , bgdf , xeet , raks }; Output: Yes a x m y b g d f x e e

Input: grid[][] = {"axmy", "bgdf", "xeet", "raks"}; Output: Yes a x m y b g d f x e e t r a k s Input: grid[][] = {"axmy", "brdf", "xeet", "rass"}; Output : No 

Help coding so the output is similar as above. I already have the grid of random letters.

# include

# include

# include

int x;

int y;

char grid [10] [10];

int z;

int j;

int main()

{

// declare array withalphabet

char alphabet[26] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g',

'h', 'i', 'j', 'k', 'l', 'm', 'n',

'o', 'p', 'q', 'r', 's', 't', 'u',

'v', 'w', 'x', 'y', 'z' };

printf ("Insert the width (x) and height (y) of the grid ");

scanf ("%d %d", &x, &y);

for (z = 0; z < x; z++)

{

for (j=0; j < y; j++)

{

// print letters instead of dots

grid [z] [j] = alphabet[rand() % 26];

}

}

for (z = 0; z < x; z++)

{

for (j=0; j < y; j++)

{

printf ("%c", grid [z] [j]);

}

printf (" ");

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions