Hello i am new the the programing sene and im trying to create a program for my help with my html and i am stuck! I can get basic HEX code from like CC to 204 dec. but i cant go backwards? and i want to be able to tell the computer that i want 80% red 40% blue and 20% green then it tells me in HEX what that is... but im stumped could any one help me?
heres what i have so far
#include <cstdlib>
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
int main(int argc, char *argv[])
{
int z; // Percentage Red
float redhex; // The hex equivilent of Red
float redrightnib; // This is the right nib of red
float redleftnib; // This is the left nib of red
int x; // Percentage Green
float greenhex; // The hex equivilent of Green
float greenleftnib; // This is the left nib of green
float greenrightnib; // This is the right nib of green
int y; // Percentage Blue
float bluehex; // The hex equivilent of Blue
float blueleftnib; // This is the left nib of blue
float bluerightnib; // This is the right nib of blue
cout << "Tell Me The Color You Want in Percentage Form 0-100" << endl;
cout << "Tell Me The Red Percentage First" << endl;
cin >> z;
if (z>=0, z<=100)
{
cout << "Ok Good Now give me the Green Percentage" << endl;
cin >> x; // The Color Green in persentage
if (x>=0, x<=100)
{
cout << "Now the Blue Percentage" << endl;
cin >> y;
if (y>=0, y<=100)
{
cout << "Ok In Hexcode " << z<< "%," << x << "%," << y << "%" << " Equals" << endl;
redhex = (z*255)/100;
redhex/16
//equation????
greenhex = (x*255)/100;
//equation????
bluehex = (y*255)/100;
//equation????
cout << "#" << redleftnib << redleftnib << ", " << blueleftnib << bluerightnib << ", " << greenleftnib << greenrightnib << endl;
}
else
{
cout << "No!" << endl;
}
}
else
{
cout << "I said 0-100!" << endl;
}
}
else
{
cout << "Did you Even Read The Directions" << endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}