Question
#include using namespace std; #ifndef _COLOR_HPP #define _COLOR_HPP class Color{ private: int r, g, b; public: Color(); Color(int red, int green, int blue); void set(int
#include
using namespace std;
#ifndef _COLOR_HPP #define _COLOR_HPP
class Color{ private: int r, g, b; public: Color(); Color(int red, int green, int blue); void set(int new_r, int new_g, int new_b); int get_red(); int get_green(); int get_blue(); void invert(); void scale(double s); void print(ostream &out); };
#endif
#include "Color.hpp"
Color::Color(){ set(0, 0, 0); }
Color::Color(int red, int green, int blue){ if(red >= 0 && red = 0 && green = 0 && blue
int Color::get_red(){ return r; }
int Color::get_green(){ return g; }
int Color::get_blue(){ return b; }
void Color::set(int new_r, int new_g, int new_b){ if(new_r >= 0 && new_r = 0 && new_g = 0 && new_b
void Color::invert(){ r = 255 - r; g = 255 - g; b = 255 - b; }
void Color::scale(double s){ if(s * r >= 0 && s * r = 0 && s * g = 0 && s * b
void Color::print(ostream &out){ out
#include "Color.hpp"
int main(){ Color c1, c2(20, 30, 40), c3(255, 255, 255), c4(100, 200, 300); cout
C+ +programming
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