扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:佚名 来源:唯c世界 2007年10月28日
关键字: Linux
#include "graphics.h" #include "math.h" #include "dos.h" #include "conio.h" #include "stdlib.h" #include "stdio.h" #include "stdarg.h" #define MAXPTS 15 #define PI 3.1415926 struct PTS { int x,y; }; double AspectRatio=0.85; void LineToDemo(void) { struct viewporttype vp; struct PTS points[MAXPTS]; int i, j, h, w, xcenter, ycenter; int radius, angle, step; double rads; printf(" MoveTo / LineTo Demonstration" ); getviewsettings( &vp ); h = vp.bottom - vp.top; w = vp.right - vp.left; xcenter = w / 2; /* Determine the center of circle */ ycenter = h / 2; radius = (h - 30) / (AspectRatio * 2); step = 360 / MAXPTS; /* Determine # of increments */ angle = 0; /* Begin at zero degrees */ for( i=0 ; i<MAXPTS ; ++i ){ /* Determine circle intercepts */ rads = (double)angle * PI / 180.0; /* Convert angle to radians */ points[i].x = xcenter + (int)( cos(rads) * radius ); points[i].y = ycenter - (int)( sin(rads) * radius * AspectRatio ); angle += step; /* Move to next increment */ } circle( xcenter, ycenter, radius ); /* Draw bounding circle */ for( i=0 ; i<MAXPTS ; ++i ){ /* Draw the cords to the circle */ for( j=i ; j<MAXPTS ; ++j ){ /* For each remaining intersect */ moveto(points[i].x, points[i].y); /* Move to beginning of cord */ lineto(points[j].x, points[j].y); /* Draw the cord */ } } } main() { int driver,mode; driver=CGA;mode=CGAC0; initgraph(&driver,&mode,""); setcolor(3); setbkcolor(GREEN); LineToDemo(); } |
/*pointer*/ main() { int n1,n2,n3; int *pointer1,*pointer2,*pointer3; printf("please input 3 number:n1,n2,n3:"); scanf("%d,%d,%d",&n1,&n2,&n3); pointer1=&n1; pointer2=&n2; pointer3=&n3; if (n1>n2) swap(pointer1,pointer2); if(n1>n3) swap(pointer1,pointer3); if(n2>n3) swap(pointer2,pointer3); printf("the sorted numbers are:%d,%d,%d\n",n1,n2,n3); } swap(p1,p2) int *p1,*p2; { int p; p=*p1;*p1=*p2;*p2=p; } |
main() |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者