subject

C++ 12.18 Lab - Structs
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 an 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).
The user can enter at most 10 colors. . see below for inputs
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 (called average) should take in a struct array, the rgb type for which you want to compute the average (as a string - red, blue or green) and its length. 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)
TEST #1
Input >>> 0 0 2 2 4 2
Expected output >>>> (1, 2, 2)
TEST #2
Input >>> 245 220 5 43 56 21 234 56 43
Expected output >>>> (174, 110, 23)
TEST #3
Input >>> 225 221 2 43 56 21 224 56 43 120 110 24 25 25 27
Expected output >>>> (127, 93, 23)
TEST #4
Input >>> 245 22 34
Expected output >>>> (245, 22, 34)

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
Which of the following statements correctly identifies a problem with sanitization methods? a. methods are not available to remove data ensuring that unauthorized personnel cannot retrieve data.b. even fully incinerated media can offer extractable data.c. personnel can perform sanitization steps improperly.d. stored data is physically etched into the media.
Answers: 1
question
Computers and Technology, 22.06.2019 01:30
Someone wishes to run the software on another computer system that runs an operating system that does not support the software what can he do
Answers: 3
question
Computers and Technology, 23.06.2019 01:20
Write a function balancechemical to balance chemical reactions by solving a linear set of equations. the inputs arguments are: reagents: symbols of reagents in string row array products: symbols of products in string row array elements: elements in the reaction in string row array elcmpreag: elemental composition of reactants in two dimensional numeric array elcmpprdcts: elemental composition of prducts in two dimensional numeric array hint: the first part of the problem is setting up the set of linear equations that should be solve. the second part of the problem is to find the integers from the solution. one way to do this is to mulitiply the rational basis for the nullspace by increasing larger integers until both the left-and right-side integers exist. for example, for the reaction that involves reacting with to produce and : reagents=["ch4", "o2"]; products =["co2", "h2o"]; elements =["c","h", "o"] elcmpreag=[1,4,0;
Answers: 3
question
Computers and Technology, 23.06.2019 15:20
What does a bonus object do? a. subtracts lives b. keeps track of a player's health c. gives a player an advantage d. makes text appear
Answers: 1
You know the right answer?
C++ 12.18 Lab - Structs
In this lab, you will familiarize yourself with structs through a sma...
Questions
question
Mathematics, 18.07.2019 05:30
question
Social Studies, 18.07.2019 05:30
Questions on the website: 13722361