错误错误错误! [英] errors errors errors!!!

查看:147
本文介绍了错误错误错误!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用turbo c complier获取给定代码: -



i am using turbo c complier for the given code :-

#include<iostream.h>
#include<conio.h>
#include<graphics.h>
class hexa
{
    private:
int x,y,pts[12][12],s;
float h,r;
   public:

void set(){
cout<<"enter the cordinates";
cin>>x>>y;
cout<<"enter the length of hexagonal";
cin>>s;
}
void disp(){
cout<<x<<y;
cout<<s;
}


void Draw()
    {
h = 0.5* s;
r = 0.866*s;



                pts[0][0] =x; pts[0][1] =y;
                pts[1][0] =x+h; pts[1][1] = y+r;
                pts[2][0] =x; pts[2][1] = y+r;
                pts[3][0] =x-h; pts[3][1] =y+r;
                pts[4][0] =x;  pts[4][1] =y-r;
                pts[5][0] =x-h;   pts[5][1] =y-r;
                pts[6][0] =x+h;  pts[6][1] =y-r;


  drawpoly(7,pts[0][0],pts[0][1],pts[1][0],pts[1][1],pts[2][0],pts[2][1],pts[3][0],pts[3][1],pts[4][0],pts[4][1],pts[5][0],pts[5][1],pts[6][0],pts[6][1],pts[0][0],pts[0][1]);





}




};

main()
{
hexa c;

   int gd=DETECT,gm;
   initgraph(&gd, &gm, "C:\\TurboC3\\BGI");

c.set();
c.disp();
c.Draw();


   getch();
   closegraph();
   return 0;


}





它会出现以下错误: -

1)无法将int转换为const int远*

2)类型不匹配参数_polypoints调用drawpoly(int,const int far)

3)额外参数in调用drawpoly(int,const int far)





无法恢复错误plz帮助我..我会谢谢你。



and it gives the following errors :-
1)cannot convert int to const int far*
2)type mismatch parameter _polypoints to call a drawpoly(int,const int far)
3)extra parameter in call to drawpoly(int,const int far)


am not able to recover errors plz help me .. i''ll be thankfull to uh.

推荐答案

函数 drawpoly 接受 int 和一个 int * ,而不是 int 然后加载 int s;



所以代替;

The function drawpoly takes an int and a int*, not an int and then loads of ints;

So instead of;
drawpoly(7,pts[0][0],pts[0][1],pts[1][0],pts[1][1],pts[2][0],pts[2][1],pts[3][0],pts[3][1],pts[4][0],pts[4][1],pts[5][0],pts[5][1],pts[6][0],pts[6][1],pts[0][0],pts[0][1]);





我认为你应该这样做;



I think you should do;

drawpoly(7, pts);





因为函数需要一个项目计数和指向它们的指针,而不是每个项目单独。



希望这会有所帮助,

Fredrik



as the function expects a count of items and a pointer to them, not each item individually.

Hope this helps,
Fredrik


来自编译器的错误消息告诉您,您正在错误地使用drawpoly函数。第二个参数应该引用一个一维数组点。



http://www.programmingsimplified.com/c/graphics.h [ ^ ]



Alan /
The error messages from the compiler tells you that you are using the drawpoly function incorrectly. The second argument should a reference to a one dimensional array of points.

http://www.programmingsimplified.com/c/graphics.h[^]

Alan/


这篇关于错误错误错误!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆