Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c++ please. Let's create a new data type called umbrella with two member variables: struct umbrella { float length; string color; Write a program called
c++ please.
Let's create a new data type called umbrella with two member variables: struct umbrella { float length; string color; Write a program called lab8_umbrellas.cpp that includes this data type (struct) definition before the main() method. 1. Inside main(), declare a static array that contains three umbrellas. 2. Write a for loop to read in values from the user for the length and color members of each umbrella. You do not need to check for valid user input. 3. Write a for loop to find the index of the longest umbrella. 4. Output the index, length, and color of the longest umbrella Example output (user input is highlighted): Enter length for umbrella 0: 5.3 Enter color for umbrella 0: red Enter length for umbrella 1: 7.9 Enter color for umbrella 1: green Enter length for umbrella 2: 4.1 Enter color for umbrella 2: black The longest umbrella (index 1) has a length of 7.9 and is green
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