绘制一个圆,在其内绘制一个内接红五角星(编程)

来源:百度知道 编辑:UC知道 时间:2024/06/21 09:04:49
答案提示:使用Cricle方法画圆,计算坐标使用Line画线

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <math.h>
#define PI 3.14159265357

int main(void)
{

/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int midx, midy;
int r=100;
printf("input r:");scanf("%d",&r);
registerbgidriver(EGAVGA_driver);
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "d:\\program files\\winyes\\tcpp30h");

/* read result of initialization */
errorcode = graphresult(); /* an error occurred */
if (errorcode != grOk)
{
printf("Graphics error: %s\n", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();

exit(1); /* terminate with an error code */
}

midx =