画椭圆代码出错# include # include # include # include void MidpointEllipse(int a,int b,int color); int main() { int gdriver = DETECT,gmode=0; initgraph(500,600); MidpointEllipse(4,6,RED); getch(); closegraph(); return 0; } void MidpointE

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/08 17:55:22

画椭圆代码出错# include # include # include # include void MidpointEllipse(int a,int b,int color); int main() { int gdriver = DETECT,gmode=0; initgraph(500,600); MidpointEllipse(4,6,RED); getch(); closegraph(); return 0; } void MidpointE
画椭圆代码出错
# include # include # include # include void MidpointEllipse(int a,int b,int color); int main() { int gdriver = DETECT,gmode=0; initgraph(500,600); MidpointEllipse(4,6,RED); getch(); closegraph(); return 0; } void MidpointEllipse(int a,int b,int color) { int x, y; float d1,d2; x=0; y=b; d1=b*b+a*a(-b+0.25); putpixel(x,y,color); while(b*b*(x+1)0) { if(d2<0) { d2+=b*b*(2*x+2)+a*a*(-2*y+3); x++;y--; } else { d2+=a*a*(-2*y+3); y--; } putpixel(x,y,color); } } d1=b*b+a*a(-b+0.25); d1+=(b*b*(2*x+3)+a*a(-2*y+2));__ error C2064: term does not evaluate to a function d2=sqr(b*(x+0.5))+sqr(a*(y-1))-sqr(a*b);__ error C2065: 'sqr' : undeclared identifier

画椭圆代码出错# include # include # include # include void MidpointEllipse(int a,int b,int color); int main() { int gdriver = DETECT,gmode=0; initgraph(500,600); MidpointEllipse(4,6,RED); getch(); closegraph(); return 0; } void MidpointE
d1=b*b+a*a(-b+0.25); d1+=(b*b*(2*x+3)+a*a(-2*y+2));改成 d1=b*b+a*a*(-b+0.25); d1+=(b*b*(2*x+3)+a*a*(-2*y+2)); d2=sqr(b*(x+0.5))+sqr(a*(y-1))-sqr(a*b);改成 d2=sqrt(b*(x+0.5))+sqrt(a*(y-1))-sqrt(a*b);