Answered step by step
Verified Expert Solution
Question
1 Approved Answer
a cpp program Specifications: You need to create two structs. The first struct is for the hunters ships. This struct needs to contain a numeric
a cpp program
Specifications: You need to create two structs. The first struct is for the hunters ships. This struct needs to contain a numeric variable to keep track of the ships health. Another numeric variable to keep track of how many people are on the ships. The struct needs to also have a variable to keep track of if they have a captured dragon on board or not. The second struct is for the dragon riders. This struct needs to contain; a string for the riders name, a string for the dragons name, a numeric variable to track the dragon/ riders health and a variable to track if the dragon and rider are captured or not. Note, the health for this struct is a single value as the dragon and rider are considered one unit for this program. Do not track them separately. You need to create two arrays. The first is an array of hunter ships. The second is an array of dragon riders. The ship array is of size 7, while the rider array is of size 5. The riders should be given the correct names (ie. Hiccup/Toothless, Astrid/Stormfly, Fishlegs/Meatlug, Snotlout/Hookfang, Rufnut and Tufnut/Barf and Belch). Names should be taken in from the user. The riders can have a health between 15-20, generated randomly for each rider. Each ship can have a health between 30-40 and 10-15 men. Each "round" of the battle, the dragons and ships will attempt to attack each other. Each dragon riders have a 70% chance to hit the ships, dealing 5-10 damage. Each attack also has a 30% chance to remove 2-3 men from the battle (either they jump ship, get hit by the dragon blast, etc.). If a ship loses all of its health, then it is sunk/surrendered/etc. and removed from the battle. Each ship has a 40% chance to hit the dragon riders, dealing 4-5 damage each hit. If the dragon riders lose all of their health they are knocked out of the sky and captured by a ship. Captured dragons cannot attack and sunk ships cannot attack. The battle goes until all ships are sunk/captured or all riders are captured. You must output each hit or miss during a round. Each round must be clearly delineated from each other. You must also output whenever a ship or rider is taken down. Once the battle is done, you need to announce who is victorious and what the final stats of riders vs ships still standing is 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