Draw circle using Trig functions
May 12, 2016 at 10:07am UTC
Hello, can someone help me out? I am trying to draw and display a circle on the CMD using Trigonometric functions like Sin and Cos. How can I go about drawing something like this?
Any tips are appreciated.
May 12, 2016 at 7:20pm UTC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
void t_25()
{
double fi,fir;
double rad;
double x,y;
int nl;
int jy;
rad=20;
for (jy=0;jy<rad;jy++)printf(" " );
for (fi=180,nl=-rad;fi>=0;fi--)
{
fir=fi*M_PI/180;
x=rad*cos(fir);
y=rad*sin(fir);
for (;nl<x-1;nl++)
{
printf("\n" );
for (jy=0;jy<rad;jy++)printf(" " );
}
for (jy=0;jy>-y;jy--)
printf("\b" );
for (;jy<0;jy++)
printf("*" );
for (;jy<y;jy++)
printf("*" );
for (;jy>0;jy--)
printf("\b" );
}
printf("\n" );
}
Topic archived. No new replies allowed.