论坛: 编程破解 标题: 一个头昏眼花的东西 复制本贴地址    
作者: kenter1643 [kenter1643]    论坛用户   登录
#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;
ycenter = h / 2;
radius = (h - 30) / (AspectRatio * 2);
step = 360 / MAXPTS;
angle = 0;
for( i=0 ; i<MAXPTS ; ++i ){
rads = (double)angle * PI / 180.0;
points[i].x = xcenter + (int)( cos(rads) * radius );
points[i].y = ycenter - (int)( sin(rads) * radius * AspectRatio );
angle += step;
}
circle( xcenter, ycenter, radius );
for( i=0 ; i<MAXPTS ; ++i ){
for( j=i ; j<MAXPTS ; ++j ){
moveto(points[i].x, points[i].y);
lineto(points[j].x, points[j].y);
} } }
main()
{int driver,mode;
driver=CGA;mode=CGAC0;
initgraph(&driver,&mode,"");
setcolor(3);
setbkcolor(GREEN);
LineToDemo();
getch();}


地主 发表时间: 08/25 10:14

回复: 286 [unique]   版主   登录
改一行,程序就会好得多.
driver=CGA;mode=CGAC0; ===> driver=DETECT;mode=0;

程序画的不准确.





B1层 发表时间: 08/25 13:18

论坛: 编程破解

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号