标题:搞了大半天终于转了
只看楼主
司徒瑾贤
Rank: 2
等 级:论坛游民
帖 子:25
专家分:44
注 册:2010-3-18
结帖率:71.43%
已结贴  问题点数:8 回复次数:1 
搞了大半天终于转了
#include<stdio.h>
#include<graphics.h>
#include<math.h>
#include<dos.h>
#include<conio.h>


#define pi    3.1415926
#define angle 2*pi/360
 

void draw_outline(void){
  int x[360];
  int y[360];
  int i=0;
  int j=0;
  for(i=0;i<360;i++){
   x[i]=320+50*cos(i*angle);
   y[i]=230+50*sin(i*angle);
  }
   setcolor(YELLOW);
   circle(320,230,100);
   ellipse(x[359],y[359],0,180,50,50);
   ellipse(x[359-180],y[359-180],180,360,50,50);
   for(i=358;i>=0;i--){
   j=i-180;
   setcolor(YELLOW);
   circle(320,230,100);
   ellipse(x[i],y[i],0-i,180-i,50,50);
   ellipse(x[j],y[j],180-i,360-i,50,50);
   setcolor(WHITE);
   circle(x[i],y[i],10);
   setcolor(YELLOW);
   circle(x[j],y[j],10);

   setcolor(BLACK);
   ellipse(x[i+1],y[i+1],0-i-1,180-i-1,50,50);
   ellipse(x[j+1],y[j+1],180-i-1,360-i-1,50,50);
   circle(x[i+1],y[i+1],10);
   circle(x[j+1],y[j+1],10);
   delay(3000);
   if(j==0){
   setcolor(BLACK);
   ellipse(x[i],y[i],0-i,180-i,50,50);
   ellipse(x[j],y[j],180-i,360-i,50,50);
   circle(x[j],y[j],10);
   circle(x[i],y[i],10);
   i=358;

   }
  }
}

int main(void){
int gmode=VGA;
int gdriver=VGAHI;
initgraph(&gmode,&gdriver,"");
draw_outline();

getch();
closegraph();
return 0;
}
搜索更多相关主题的帖子: include angle 
2011-11-05 20:23
pauljames
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:千里冰封
威 望:9
帖 子:1555
专家分:10000
注 册:2011-5-8
得分:8 
恭喜了

经常不在线不能及时回复短消息,如有c/单片机/运动控制/数据采集等方面的项目难题可加qq1921826084。
2011-11-05 21:00



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-354381-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.130961 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved