| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 597 人关注过本帖
标题:[求助]关于circle的的错误,莫名其妙的
只看楼主 加入收藏
eyegood
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-5-1
收藏
 问题点数:0 回复次数:2 
[求助]关于circle的的错误,莫名其妙的
大一新生,刚学c,碰到个画图问题,我用的是TURBOC2,编译过程中出的错误在程序上说明了.......


#include"graphics.h"
#include"math.h"
#include"dos.h"
#include"conio.h"
#include"stdio.h"
#include"stdlib.h"
#include"stdarg.h"
#define MAXPTS 15
#define PI 3.1415926
struct PTS {
int x,y;
}
double AspectRatdio=0.85; <<<===提示“too many types in declaration”
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) / (AspectRatdio*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 * AspectRatdio);
angle += step;
}
circle( xcenter , ycenter , radius ); <<<===提示“ type mismatch in redeclaration of 'circle'”
for( i=0 ; i<MAXPTS ; ++i){ <<<=== 提示“declaration syntax error in function circle”
for( j=i ; j<MAXPTS ; ++j){
moveto(points[i].x,points[i].y);
lineto(points[j].x,points[j].y);
}}} <<<===提示“ parameter 'radius' is nerver used in function circle ”
main()
{
int driver,mode;
driver=CGA;mode=CGAC0;
initgraph(&driver,&mode,"");
setcolor(3);
setbkcolor(GREEN);
LineToDemo();
}


我不明白错在什么地方了.........奇怪......

搜索更多相关主题的帖子: circle include PTS struct 
2007-05-01 20:32
cdmalcl
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:24
帖 子:4091
专家分:524
注 册:2005-9-23
收藏
得分:0 
以下是引用eyegood在2007-5-1 20:32:11的发言:
大一新生,刚学c,碰到个画图问题,我用的是TURBOC2,编译过程中出的错误在程序上说明了.......


#include"graphics.h"
#include"math.h"
#include"dos.h"
#include"conio.h"
#include"stdio.h"
#include"stdlib.h"
#include"stdarg.h"
#define MAXPTS 15
#define PI 3.1415926
struct PTS {
int x,y;
};//没加;
double AspectRatdio=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) / (AspectRatdio*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 * AspectRatdio);
angle += step;
//去掉}
circle( xcenter , ycenter , radius );
'circle'”
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();
}


我不明白错在什么地方了.........奇怪......


就两个地方错了

2007-05-01 20:39
eyegood
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-5-1
收藏
得分:0 
多谢,SUCCESS 了!!
2007-05-03 16:24
快速回复:[求助]关于circle的的错误,莫名其妙的
数据加载中...
 
   



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

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