F How can we draw the Olympic logo on the screen using the graphics features using C language ? | CodeTheta

How can we draw the Olympic logo on the screen using the graphics features using C language ?

/* http://native-code.blogspot.com */
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#define GPATH "C:\\TC\\BGI"
void mp(int, int, int,int);
void cpp(int, int, int, int, int);
void main()
{
int xc, yc, r;
int gd=DETECT, gm;
initgraph(&gd, &gm, GPATH);
r=60;
xc=getmaxx()/2;
yc=getmaxy()/2;
mp(r, xc,yc, 1);
xc=((getmaxx()/2)-((2*r)+5));
yc=getmaxy()/2;
mp(r, xc, yc, 3);
xc=((getmaxx()/2)+((2*r)+5));
yc=getmaxy()/2;
mp(r, xc, yc, 4);
xc=((getmaxx()/2)-((2*r)+5)/2);
yc=((getmaxy()/2)+((2*r)+5)/2);
mp(r, xc, yc, 14);
xc=((getmaxx()/2)+((2*r)+5)/2);
yc=((getmaxy()/2)+((2*r)+5)/2);
mp(r, xc, yc, 2);
getch();
}
void mp(int r, int xc, int yc, int c)
{
int x, y, p;
x=0;
y=r;
p=1-r;
cpp(xc, yc, x, y, c);
while(x<=y)
{
x++;
if(p<0)
p+=2*(x-1);
else
{
p+=2*(x-y)+1;
y--;
}
cpp(xc, yc, x, y,c);
}
}
void cpp(int xc, int yc, int x, int y, int c)
{
putpixel(xc+x, yc+y, c);
putpixel(xc+y, yc+x, c);
putpixel(xc-x, yc+y, c);
putpixel(xc+y, yc-x, c);
putpixel(xc+x, yc-y, c);
putpixel(xc-y, yc+x, c);
putpixel(xc-x, yc-y, c);
putpixel(xc-y, yc-x, c);
}
/* http://native-code.blogspot.com */

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us