Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. int color_scheme_converter::cmy2rgb() {
  2. CMY cmy = { 0, 0, 0 };
  3. RGB rgb = { 0, 0, 0 };
  4.  
  5. //Eingabe
  6. cout << "Bitte CMY-Wert (cyan) eingeben. Wert zwischen 0 und 100:" << endl;
  7. cin >> cmy.c;
  8. if (cmy.c < 0 || cmy.c > 100) {
  9. cout << "Der Wert " << cmy.c << " scheint nicht korrekt zu sein!" << endl;
  10. return -1;
  11. }
  12. cout << "Bitte CMY-Wert (magenta) eingeben. Wert zwischen 0 und 100:" << endl;
  13. cin >> cmy.m;
  14. if (cmy.m < 0 || cmy.m > 100) {
  15. cout << "Der Wert " << cmy.m << " scheint nicht korrekt zu sein!" << endl;
  16. return -1;
  17. }
  18. cout << "Bitte CMY-Wert (gelb) eingeben. Wert zwischen 0 und 100:" << endl;
  19. cin >> cmy.y;
  20. if (cmy.y < 0 || cmy.y > 100) {
  21. cout << "Der Wert " << cmy.y << " scheint nicht korrekt zu sein!" << endl;
  22. return -1;
  23. }
  24.  
  25. float r = ((float)cmy.c / 100) * 255;
  26. float g = ((float)cmy.m / 100) * 255;
  27. float b = ((float)cmy.y / 100) * 255;
  28.  
  29. cout << "R: " << r << " G: " << g << " B: " << b << endl;
  30.  
  31. return 0;
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement