Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int color_scheme_converter::cmy2rgb() {
- CMY cmy = { 0, 0, 0 };
- RGB rgb = { 0, 0, 0 };
- //Eingabe
- cout << "Bitte CMY-Wert (cyan) eingeben. Wert zwischen 0 und 100:" << endl;
- cin >> cmy.c;
- if (cmy.c < 0 || cmy.c > 100) {
- cout << "Der Wert " << cmy.c << " scheint nicht korrekt zu sein!" << endl;
- return -1;
- }
- cout << "Bitte CMY-Wert (magenta) eingeben. Wert zwischen 0 und 100:" << endl;
- cin >> cmy.m;
- if (cmy.m < 0 || cmy.m > 100) {
- cout << "Der Wert " << cmy.m << " scheint nicht korrekt zu sein!" << endl;
- return -1;
- }
- cout << "Bitte CMY-Wert (gelb) eingeben. Wert zwischen 0 und 100:" << endl;
- cin >> cmy.y;
- if (cmy.y < 0 || cmy.y > 100) {
- cout << "Der Wert " << cmy.y << " scheint nicht korrekt zu sein!" << endl;
- return -1;
- }
- float r = ((float)cmy.c / 100) * 255;
- float g = ((float)cmy.m / 100) * 255;
- float b = ((float)cmy.y / 100) * 255;
- cout << "R: " << r << " G: " << g << " B: " << b << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement