Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

***PLEASE DO IT IN C++*** In this lab, you will familiarize yourself with structs through a small exercise. We will be mixing the RGB values

image text in transcribed

***PLEASE DO IT IN C++***

In this lab, you will familiarize yourself with structs through a small exercise. We will be mixing the RGB values of colors together to make a new one. RGB stands for red, green and blue. Each element describes the intensity value ranging from 0-255. For example: black color will have RGB values (0, 0, 0) while white will have (255, 255, 255) Create a dynamic array of structs color. The struct contains three integers named red, green and blue. This corresponds to the RGB values of a color. For each array element, ask the user to enter the intensity value of red, green and blue. The value should be between 0 and 255 (inclusive) Additionally, compute the average of each of the red, green and blue components. For code modularity, implement a function that returns the average of each rgb component in your dynamic array. The function should take in a struct array, its length and the rgb type for which you want to compute the average. Print out the final result in the form (r, g, b), where r, g, b corresponds to each averaged value. Can you guess what color you mixed? (Note: Your program does not need to print the final color mixed)

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 2 Lnai 9285

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Joao Gama ,Alipio Jorge ,Carlos Soares

1st Edition

3319235249, 978-3319235240

More Books

Students also viewed these Databases questions