Devam Ediyor

2 dimensional array

Write a C++ program, [url removed, login to view], that randomly finds a path from the center of a two dimensional array.

The program first initializes a two dimensional char array to all periods. The program starts at the middle of the array. It places an ‘a’ at this spot in the array. It then repeatedly picks a random direction (up, down, left or right) that travels to a spot not yet visited and places the next letter of the alphabet there. The program stops when the pathway reaches an edge of the array or there is no legal spot to move.

You are required to write the following functions to help solve the problem:

// set all spots in the board equal to period

// characters

void init_board (char board [max_row][max_col]);

// sets row and col equal to a new row and column using

// a random move (up, down, left or right) to a spot in

// the array not yet visited

void move (char box[max_row][max_col], int& row, int& col);

// function returns true if there is no legal move (up,

// down, right, or left) from current row and column.

bool fail (char box[max_row][max_col], int row, int col);

// function returns true if the edge of the box has been

// reached

bool success (int row, int col);

// prints the array in two dimensional format with

// a single linefeed between rows and no spaces.

void print (char box [max_row][max_col]);

// returns the next character to be printed in the path

// given the current character. Letters change from

// lowercase to uppercase to lowercase…

char next (char current);

max_row and max_col are constants giving the size of the array. The program should work for different values of max_row and max_col.

When the lowercase alphabet is exhausted, the markers should change to the uppercase alphabet. When the uppercase alphabet is exhausted, the markers should change back to lowercase alphabet, and so on.

If an edge of the array is reached, the word “Success” should be printed along with the array. When there is no legal move from a spot, the word “Failure” should be printed along with the array.

Two runs of the program with max_row = 20 and max_col = 50 are shown on the next page of this handout. The program should run differently each run.

When done, place the [url removed, login to view] file in the Homework 2 assignment area on Blackboard.

Run 1 (max_row = 20, max_col = 30):

Success!

The path is:

..............................

..............................

..............................

..............................

..............................

..............................

..............................

..............................

.........................vwzA.

...............a.........uxyBC

.............feb.....VWXst....

.............gdcPQRSTU.Yr.....

............ih..ON.....Zqp....

............juv..M.....ano....

..........mlktw.KLGF...bml....

..........norsxyJIHE...c.kji..

...........pq..zABCD...defgh..

..............................

..............................

..............................

Run 2 (max_row = 15, max_col = 30):

Failure!

The path is:

..............................

..............................

..............................

..............................

..............................

............gf................

............hedc..............

.........nmli..b..............

.........oxkj..a..............

.........pwv..................

.........q.u..................

.........rst..................

..............................

..............................

..............................

Beceriler: C++ Programlama

Daha fazlasını görün: void init_board char board max_row max_col, solve the assignment problem, solve assignment problem, random function cpp, random cpp, programming with cpp, programming homework help, programming center, programming array, help with programming homework, c programming homework help, c programming char, cpp set, cpp random, cpp array, cplusplus set, cplusplus array, char in c programming, char c programming, array programming, array in c programming, array in cpp, gf, random letter, next character

İşveren Hakkında:
( 3 değerlendirme ) new york, United States

Proje NO: #6494227

Seçilen:

vietcompro

Hi there, I've already read and understood the project requirement, and I can complete this one for you. So really hope to have chance to work with you, thanks for your consideration! Regards.

0 gün içinde 30$ USD
(24 Değerlendirme)
4.2

6 freelancer bu iş için ortalamada 46$ teklif veriyor

Corei13

Hi I am an expert in C/C++ and have extensive experience on designing and implementing algorithms as a long time competitive contest programmer. Please review my profile and let me know if you are interested. Thanks Daha fazlası

1 gün içinde 35$ USD
(6 Değerlendirme)
3.8
aitgallon

hello.............message me ...........i would like to work on this...........i have very good experience in programming..............i can get your work done very quickly..........waiting for your response..thanks & Daha fazlası

1 gün içinde 25$ USD
(24 Değerlendirme)
3.6
oobretenov

I could help you. . . .

1 gün içinde 40$ USD
(5 Değerlendirme)
2.8
sachitjani81

can do iit...........................................................................................

1 gün içinde 111$ USD
(1 Değerlendirme)
1.9
prodanovh

Everything you need will be implemented in the program. Centered 'A' going in random direction every time. Pick me and you will not be disappointed. Thank you :) Have a nice day.

in 3 gün içinde35$ USD
(0 Değerlendirme)
0.0
maoo92

I can start right away. Can get it done in 4-6 hours tops. Have a lot of experience in c/c++ developing. Been studying it for 6 ears now. Waiting for you response.

in 0 gün içinde25$ USD
(0 Değerlendirme)
0.0