I created a function called “setToGrey” that returns no value and accepts a single parameter of type “Colour”. How would I set the red, green and blue channels all to 128, leaving the alpha unaffected passing by reference? Hope this makes sense! Thank you!
#include "stdafx.h"
#include <iostream>
using namespace std;
struct colour
{
int red;
int green;
int blue;
int alpha;
colour()
{
red = 0;
green = 0;
blue = 0;
alpha = 255;
}
void settogrey(colour& the_input_parameter)
{
the_input_parameter.red = 128;
the_input_parameter.blue = 128;
the_input_parameter.green = 128;
}
colour colour1; // create an object of type colour, named colour1
settogrey(colour1); // pass that object to the function