Đang Thực Hiện

Recursion in c++

Consider an NxN grid in which some squares are occupied. Two squares belong to the same group if they share a common edge (not just a corner). In the figure there is one group of four occupied squares, three groups of two occupied squares, and two individual occupied squares.

.........X

...XX....X

..........

....X..X..

...X...X..

.......XX.

....XX....

..........

..........

..........

you are to develop a C++ class called Recursion that contains the following:

-a 2D int array with 10 rows and 10 columns.

-a constructor or function that reads a file into the array. Each line of the file is a row of the array. The character . should be converted to 0, and any other character converted to 1

A sample file is attached

-a function print() that causes the printout of all groups contained in the 2D array. It should make a copy of the member array, and make use of a recursive method printGroupWith.

-a recursive method printGroupWith. (Think about the right parameter list.) This function should cross-off the copy of the array as it goes.

-a main function that takes a filename from the command line, creates a suitable Recursion object and calls print on it.

For example, for the sample grid above, the output of your program should be something like (not including comments): Note that your order might be different

Group 1: (0,9), (1,9) // the two occupied squares in upper right corner

Group 2: (1,3), (1,4) // the two occupied squares in row 1

Group 3: (3,4)

Group 4: (3,7), (4,7), (5,7), (5,8)

Group 5: (4,3)

Group 6: (6,4), (6,5)

You may include additional private helper functions, if you wish.

Kỹ năng: Lập trình C++

Xem thêm: recursive programming example, recursive programming, recursive program example, recursive function example, recursion programming, recursion function, programming recursion, functions programming, programming array, cplusplus array, command group, array programming, character figure, command line print file, command line print, object function method, command line parameter, figure print, recursive function, function recursion, cross object, member function contains array, recursive program, recursive functions, print grid

Về Bên Thuê:
( 13 nhận xét ) Clemson, United States

Mã Dự Án: #4550262

Đã trao cho:

bdlions

Hello, Please check private message.

$30 USD trong 3 ngày
(0 Đánh Giá)
0.0

2 freelancer đang chào giá trung bình $33 cho công việc này

MujtabaAwan

I can provide you this work in few hours.

$35 USD trong 3 ngày
(0 Đánh Giá)
0.0