为什么画不了圆弧?
给定圆弧的起始角与终止角,半径自定,画一圆弧,我写的代码如下,但为什么总是画不出来,错在哪里?求高手指教!
#include "math.h"
#include "graphics.h"
#include "stdlib"
void yuanhu(int xc,int yc,int r,int th1,int th2)
{
int x,y,i;
double t;
x=xc+r*cos(th1*3.14159/180);
y=yc+r*sin(th1*3.14159/180);
moveto(x,y);
for(i=th1;i<=th2;i++)
{
t=i*3.14159/180;
x=xc+r*cos(t);
y=yc+r*sin(t);
lineto(x,y);
}
}
main()
{
int th1,th2;
int gd=DETECT,gm;
printf("input th1 and th2: ");
scanf("%f,%f",&th1,&th2);
initgraph(&gd,&gm,"");
setbkcolor(15);
setcolor(9);
yuanhu(320,240,100,th1,th2);
getch();
closegraph();
}