some awesome graphics codes.. Presented by MY C FILES
Code 1
Code 1
Code 2
Code 2
Code 3
Code 3
Code 4
Code 4
Code 1
Code 1
/*www.mycfiles.com*/
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <graphics.h>
#include<stdlib.h>
#include<dos.h>
void main()
{
int dr,md,midx,i, midy,mx, my,x,y,fact;
double pi,tpi,a,t,r;
dr = DETECT;
fact=220;
initgraph(&dr, &md, "c:\\tc\\bgi");
midx = getmaxx()/2; midy = getmaxy()/2;
pi = 3.14159;
tpi = pi * 2.0;
for (a=0.0; a<tpi; a=a+pi/660)
{
r = fact * (cos(8*a)); // r = fact * (cos(a) * sin(a))
x = midx + r * cos(a);
y = midy + r * sin(a);
putpixel(x,y,random(getmaxcolor()));
}
getch();
}
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <graphics.h>
#include<stdlib.h>
#include<dos.h>
void main()
{
int dr,md,midx,i, midy,mx, my,x,y,fact;
double pi,tpi,a,t,r;
dr = DETECT;
fact=220;
initgraph(&dr, &md, "c:\\tc\\bgi");
midx = getmaxx()/2; midy = getmaxy()/2;
pi = 3.14159;
tpi = pi * 2.0;
for (a=0.0; a<tpi; a=a+pi/660)
{
r = fact * (cos(8*a)); // r = fact * (cos(a) * sin(a))
x = midx + r * cos(a);
y = midy + r * sin(a);
putpixel(x,y,random(getmaxcolor()));
}
getch();
}
Code 2
Code 2
/*www.mycfiles.com*/
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <graphics.h>
#include<stdlib.h>
#include<dos.h>
void main()
{
int dr,md,midx,i, midy,mx, my,x,y,fact;
double pi,tpi,a,t,r;
dr = DETECT;
fact=220;
initgraph(&dr, &md, "c:\\tc\\bgi");
midx = getmaxx()/2; midy = getmaxy()/2;
pi = 3.14159;
tpi = pi * 2.0;
for (a=0.0; a<tpi; a=a+pi/180)
{
r = fact * (cos(a) * sin(10+a));
x = midx + r * cos(a);
y = midy + r * sin(a);
putpixel(x,y,random(getmaxcolor()));
getch();
}
getch();
}
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <graphics.h>
#include<stdlib.h>
#include<dos.h>
void main()
{
int dr,md,midx,i, midy,mx, my,x,y,fact;
double pi,tpi,a,t,r;
dr = DETECT;
fact=220;
initgraph(&dr, &md, "c:\\tc\\bgi");
midx = getmaxx()/2; midy = getmaxy()/2;
pi = 3.14159;
tpi = pi * 2.0;
for (a=0.0; a<tpi; a=a+pi/180)
{
r = fact * (cos(a) * sin(10+a));
x = midx + r * cos(a);
y = midy + r * sin(a);
putpixel(x,y,random(getmaxcolor()));
getch();
}
getch();
}
Code 3
Code 3
/*www.mycfiles.com*/
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <graphics.h>
#include<stdlib.h>
#include<dos.h>
void main()
{
int dr,md,midx,i, midy,mx, my,x,y,fact;
double pi,tpi,a,t,r;
dr = DETECT;
fact=120;
initgraph(&dr, &md, "c:\\tc\\bgi");
midx = getmaxx()/2; midy = getmaxy()/2;
pi = 3.14159;
tpi = pi * 2.0;
for (fact=10; fact<=120; fact=fact+10)
{
for (a=0.0; a<tpi; a=a+pi/180)
{
r = fact * (1+cos(a));
x = midx + r * cos(a);
y = midy + r * sin(a);
putpixel(x,y,random(getmaxcolor()));
// getch();
}
getch();
}
getch();
}
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <graphics.h>
#include<stdlib.h>
#include<dos.h>
void main()
{
int dr,md,midx,i, midy,mx, my,x,y,fact;
double pi,tpi,a,t,r;
dr = DETECT;
fact=120;
initgraph(&dr, &md, "c:\\tc\\bgi");
midx = getmaxx()/2; midy = getmaxy()/2;
pi = 3.14159;
tpi = pi * 2.0;
for (fact=10; fact<=120; fact=fact+10)
{
for (a=0.0; a<tpi; a=a+pi/180)
{
r = fact * (1+cos(a));
x = midx + r * cos(a);
y = midy + r * sin(a);
putpixel(x,y,random(getmaxcolor()));
// getch();
}
getch();
}
getch();
}
Code 4
Code 4
/*www.mycfiles.com*/
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <graphics.h>
#include<stdlib.h>
#include<dos.h>
void main()
{
int dr,md,midx,i, midy,mx, my,x,y,fact;
double pi,tpi,a,t,r;
dr = DETECT;
fact=120;
initgraph(&dr, &md, "c:\\tc\\bgi");
midx = getmaxx()/2; midy = getmaxy()/2;
pi = 3.14159;
tpi = pi * 2.0;
for (fact=10; fact<=120; fact=fact+10)
{
for (a=0.0; a<tpi; a=a+pi/180)
{
r = fact * (1+cos(3+a));
x = midx + r * cos(a);
y = midy + r * sin(a);
putpixel(x,y,random(getmaxcolor()));
// getch();
}
getch();
}
getch();
}
Hope you will like this one, Post your comment and queries below... :)#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <graphics.h>
#include<stdlib.h>
#include<dos.h>
void main()
{
int dr,md,midx,i, midy,mx, my,x,y,fact;
double pi,tpi,a,t,r;
dr = DETECT;
fact=120;
initgraph(&dr, &md, "c:\\tc\\bgi");
midx = getmaxx()/2; midy = getmaxy()/2;
pi = 3.14159;
tpi = pi * 2.0;
for (fact=10; fact<=120; fact=fact+10)
{
for (a=0.0; a<tpi; a=a+pi/180)
{
r = fact * (1+cos(3+a));
x = midx + r * cos(a);
y = midy + r * sin(a);
putpixel(x,y,random(getmaxcolor()));
// getch();
}
getch();
}
getch();
}
Categories:
graphics
1 comments:
luks nic
Post a Comment