Thursday 2 February 2012

GM LAB-COLOR MODEL


Algorithm:

1. Start the program.
2. Declare the variables using structure.
3. Create the function and get the function using create () function.
4. Get the coordinates and assign the values for the coordinates.
5. Define the drawcube () function.
6. Using rotate () function, rotation is performed.
7. End the program.

PROGRAM:

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<math.h>
void main()
{
int i,j,a,b,c,d,p,q,r,s;
int gd=DETECT,gm;
initgraph(&gd,&gm," ");
printf("\n enter the color coordinates in RGB:");
scanf("%d%d%d%d",&p,&q,&r,&s);
a=1-p;
b=1-q;
c=1-r;
d=1-s;
i=(8*p)+(4*q)+(2*r)+(1*s);
if(i==0||i==1)
{
i= (8*a)+(4*b)+(2*c)+(1*d);
}
else
{ i=(4*b)+(2*c)+(1*d);
}
outtextxy(100,50,"RGB COLOR IS:");
setcolor(i);
outtextxy(100,100,"(RGB)");
setcolor(6);
delay(400);
setcolor(j);
printf("\nCMY COLOR is:");
outtextxy(150,150,"(CMY)");
getch();
closegraph();
}


MORE:

->GIVE ADS
->EARN MONY
->DOWNLOADS(softwares,wallpapers,etc)
JOB VIRUS

No comments:

Post a Comment