1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Zolol [24]
2 years ago
9

Remove gray from RGB Summary: Given integer values for red, green, and blue, subtract the gray from each value. Computers repres

ent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255. Thus (255, 0, 0) is bright red, (130, 0, 130) is a medium purple, (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray). Given values for red, green, and blue, remove the gray part.

Computers and Technology
1 answer:
sergejj [24]2 years ago
5 0

Answer:  

Here is the C++ program:  

#include <iostream>   //to use input output functions    

using namespace std;   //to identify objects cin cout    

int main() {   //start of main method    

int red,green,blue,smallest;   //declare variables to store integer values of red,green, blue and to store the smallest value    

cout<<"Enter value for red: ";  //prompts user to enter value for red    

cin>>red;  //reads value for red from user    

cout<<"Enter value for green: ";  //prompts user to enter value for green  

cin>>green; //reads value for green from user    

cout<<"Enter value for blue: "; //prompts user to enter value for blue    

cin>>blue;   //reads value for blue from user    

//computes the smallest value  

if(red<green && red<blue) //if red value is less than green and blue values    

smallest=red;   //red is the smallest so assign value of red to smallest    

else if(green<blue)   //if green value is less than blue value    

smallest=green; //green is the smallest so assign value of green to smallest  

else //this means blue is the smallest    

smallest=blue;  //assign value of blue to smallest    

//removes gray part by subtracting smallest from rgb  

red=red-smallest; //subtract smallest from red    

green=green-smallest; //subtract smallest from green    

blue=blue-smallest; //subtract smallest from blue    

cout<<"red after removing gray part: "<<red<<endl;  //displays amount of red after removing gray    

cout<<"green after removing gray part: "<<green<<endl; //displays amount of green after removing gray  

cout<<"blue after removing gray part: "<<blue<<endl;  } //displays amount of blue after removing gray  

Explanation:  

I will explain the program using an example.    

Lets say user enter 130 as value for red, 50 for green and 130 for blue. So  

red = 130    

green = 50

blue = 130  

First if condition if(red<green && red<blue)   checks if value of red is less than green and blue. Since red=130 so this condition evaluate to false and the program moves to the else if part else if(green<blue) which checks if green is less than blue. This condition evaluates to true as green=50 and blue = 130 so green is less than blue. Hence the body of this else if executes which has the statement: smallest=green;  so the smallest it set to green value.    

smallest = 50    

Now the statement: red=red-smallest; becomes:    

red = 130 - 50    

red = 80    

the statement: green=green-smallest;  becomes:    

green = 50 - 50    

green = 0    

the statement: blue=blue-smallest; becomes:    

blue = 130 - 50    

blue = 80    

So the output of the entire program is:    

red after removing gray part: 80                                                                                                 green after removing gray part: 0                                                                                                blue after removing gray part: 80    

The screenshot of the program along with its output is attached.

You might be interested in
If you’re presenting in a darkened room, what text and background should you use to provide maximum readability?1) Light text on
ludmilkaskok [199]

Answer:

1

Explanation:

1 because it would be difficult for people to read on the other ones that you put.

3 0
3 years ago
What are village by laws​
melomori [17]

Explanation:

LAWS have long been familiar to the student of the English village. these regulations dealt mai ly with the open-field husbandry and pasture rights of ....

4 0
2 years ago
Can someone tell me how to fix the keyboard on ipad?- its in the middle of my screen andd i dont know how to do it
mamaluj [8]

Answer:

Here

Explanation:

To move keyboard to bottom of screen, you just need to tap and hold the keyboard icon at the bottom-right corner of the keyboard, choose Dock option. To fix iPad keyboard in middle of screen, please tap and hold the keyboard icon, then choose Dock.Nov 5, 2020

5 0
2 years ago
A device is sending out data at the rate of 1000 bps. How long does it take to send
vredina [299]

Answer:

0.01 second ; 0.008 seconds; 800 seconds

Explanation:

Given that:

Sending rate = 1000 bps

Rate of 1000 bps means that data is sent at a rate of 1000 bits per second

Hence, to send out 10 bits

1000 bits = 1 second

10 bits = x

1000x = 10

x = 10 / 1000

x = 0.01 second

2.)

A single character 8 - bits

1000 bits = 1 second

8 bits = (8 / 1000) seconds

= 0.008 seconds

3.)

100,000 characters = (8 * 100,000) = 800,000

1000 bits = 1 second

800,000 bits = (800,000 / 1000)

= 800 seconds

4 0
2 years ago
Weakness in software can be more quickly uncovered and exploited with new software tools and techniques.
grandymaker [24]
False because it might damage it more but if it was recommended by lots of people i mean the software then its true
6 0
3 years ago
Other questions:
  • How many keywords are there in C programming language
    8·1 answer
  • I am confused about joins in sql.
    8·2 answers
  • An ___ is any person who spends times using technology at home
    10·1 answer
  • Antivirus software installed to scan and monitor malware activities on a server or workstation would be identified as a ________
    8·1 answer
  • Rerouting traffic using arp poisoning is an attack on ________ of a network.
    8·1 answer
  • Please help me with this question. I don’t get it
    11·2 answers
  • In cryptography, the term "Secret algorithm" refers to an algorithm designed in a way that prevents the examination of its inner
    12·2 answers
  • Which device makes computers that are connected to separate segments appear and behave as if they're on the same segment? (Pleas
    11·1 answer
  • When was the federal commission act put into effect?????
    13·1 answer
  • Complete the sentence about entering and editing data in a cell in a spreadsheet.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!