Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The programming language is C. Please use comment headers to specify what each section of code is for and what is does. Obiectives 1. To
The programming language is C. Please use comment headers to specify what each section of code is for and what is does.
Obiectives 1. To learn how to use 2 dimensional arrays to store and retrieve data to help solving problems. Movies about dragons and dragon training were very popular this summer. Your friend has not stopperd talking about how awesome dragons are and how cool it would be to train them. To amuse your friend you have decided to create a series of programs about dragons Now that your dragon has participated in the Celebration of the First Flight, they are a fully recognized dragon! You've just found out that several of your friends just had their dragons pass their Celebration too. Now it's a race to see which of you will become the first dragon rider. To start riding a dragon, you need the following items: 0) Fleece Blanket 1) Saddle 2) Leather Jacket 3) Flight Harness 4) Goggles 5) Helmet At night, you and your friends will try to sneak out and obtain these pieces from the Dragon Island equipment shed. Each of you will take turns trying to gain a piece of equipment, simulated by a randomly generated number from O to 6. Six of those numbers (0-5) correspond to the numbers above, while 6 corresponds to "You've been caught! Lost a piece of equipment If you get a number that corresponds to an item you already have, nothing happens. If you get a saddle (item 1), you may only pick up the item if you already have a blanket (item O). If you get a flight harness (item 3), you may only pick up the item if you already have a jacket (item 2). This is because you cannot put a saddle on your dragon without the blanket underneath and you cannot put a flight harness orn yourself without a jacket underneath. If you land on "You've been caughti", then you must choose which piece of equipment to discard. If you have no pieces to begin with, then you don't lose anything. If you have a saddle(1), then you cannot discard the blanket(0) and if you have a harness(3), then you cannot discard the jacket(2) The first person to obtain all six items will become the first dragonrider You must use a 2D array to solve the problem. There will be no more than 6 people trying to "borrow equipment. You may wish to use these data structures to help you solve the problem int cont = 1; int riders[6l(6): char ITEMS6][20] = {"BLANKET", "SADOLE", "JACKET", "HARNESS", "GOGGLES", "HELMET"); For example, to print "SADDLE-we could The values in-ITEMS" are strings and may be printed with %s. use print\"%s". ITEMS[ 1]) Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started