Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ Implement a linked list with a shape like the following grid. L I V E There are 4 tiles in the grid. Each tile

c++

Implement a linked list with a shape like the following grid.

L

I

V

E

There are 4 tiles in the grid. Each tile has two data members and we can define the struct like this:

struct listNode {

char data;

listNode *arr[3];

listNode (char x)

{

data = x;

arr[0] = nullptr;

arr[1] = nullptr;

arr[2] = nullptr;

};

};

Simulate the situation that a robot takes a random walk on the grid (by using a random number generator). Initially it is on the L tile. In each move it switches its position to anyone of the other three. The system displays the position that it is on. Do the random walking for 10 times and display 10 characters which the robot just stepped on.

Thank you ahead of time for your help.

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

2. Show the trainees how to do it without saying anything.

Answered: 1 week ago