Страница 1 из 1

проблема с кодом Borland C 3.1 код внутри

Добавлено: 10 мар 2011, 00:37
Nickstery

Код: Выделить всё

#include <conio.h>                     //getch
#include <graphics.h>                  //grafiki
#include <stdlib.h>                    //randomize
#include <math.h>
#include <dos.h>

class TShape {                        			//stvorymo class TShape
  protected : int x,y,color;                            //dostup lyshe metodam classu ta pohidnyh klassiv
  public : TShape(int ix, int iy, int icolor);          //
  ~TShape();
  virtual void Draw(int c)=0;
  void Show();
  void Hide();
};
void TShape::Show(){
  Draw(color);
}
void TShape::Hide(){
  Draw(BLACK);
}
TShape::TShape(int ix, int iy,int icolor){
  x=ix;
  y=iy;
  color=icolor;
}
TShape::~TShape(){}

//----------------------------------------//
class TPoint: public TShape{
  public : TPoint (int ix, int iy, int icolor);
  void Draw(int c);
};

TPoint::TPoint(int ix, int iy,int icolor):TShape(ix,iy,icolor){}

void TPoint: :D raw(int c){
  int i,j,p=0;
      while (p!=20)
     { {i=i+3;
      p=p++;
      }
      putpixel(i,j++,c);
      }

}
class Elipse: public TPoint{
  protected: int rmin, rmax;
  public: Elipse( int ix, int iy ,int irmin ,int irmax,int icolor);
  void Draw(int c);
  void Move();
  void Color();
};

Elipse :: Elipse( int ix, int iy,int irmin, int irmax,int icolor):TPoint(ix,iy,icolor){ rmin=irmin; rmax=irmax;}
void Elipse: :D raw(int c){
  setcolor(c);

   int t=0;
     while (t!=20)
      {
    setcolor(RED);

  ellipse(x,y,0,360,rmin,rmax);
   delay(120);
	 setcolor(BLACK);
    ellipse(x,y,0,360,rmin,rmax);
    t=t++;
  
  rmin=rmin-5;


	    }


}
void Elipse::Move(){





}

void Elipse::Color(){
  Show();
  int a;
  while(a!='e'){
    a=getch();
    Hide();
    if(a=='c')
    color++;
    Show();
  }
}


//Na4alo sector//
 

class Sector: public Elipse{
  protected: int midx, midy,stangle, endangle,xrad, yrad;
  public: Sector( int imidx, int imidy ,int istangle ,int iendangle,int ixrad, int iyrad,int icolor);
  void Draw(int c);
  void Move();
  void Color();
};
int ix,iy,irmin,irmax;
Sector :: Sector( int imidx, int imidy,int istangle, int iendangle, int ixrad, int iyrad,int icolor):Elipse(ix, iy,irmin, irmax,icolor){ midx=imidx; midy=imidy; stangle=istangle; endangle=iendangle;xrad=ixrad;yrad=iyrad;}
void Sector: :D raw(int c){
  setcolor(c);


 int t=0;
     while (t!=20)
      {
setcolor(WHITE);
delay(120);

sector(midx, midy, stangle, endangle, xrad, yrad);

setcolor(BLUE);



 midx = getmaxx() / 2;
   midy = getmaxy() / 2;


 sector(midx, midy, stangle, endangle, xrad, yrad);
xrad=100*sin(t);
yrad=100*cos(t);

}
   }


void Sector::Move(){





}

void Sector::Color(){
  Show();
  int a;
  while(a!='e'){
    a=getch();
    Hide();
    if(a=='c')
    color++;
    Show();
  }
}







int main(){
  int point_color,ring;
  int graphdriver=DETECT, graphmode;
  initgraph(&graphdriver, &graphmode, "I:\\BC\\BGI");

  TPoint *p;
  Elipse *e;
  Sector *q;

  
  e=new Elipse(300,300,100,50,3);
  p=new TPoint(400,400,4);
  q=new Sector(200,200,45,135,200,100,150);
  
  p->Show();
  e->Move();
  e->Color();
  e->Hide();
q->Move();
  q->Color();
  q->Hide();
  getch();
  closegraph();
  return 0;
}
Собственно вот, код, и проблема в том что не отображается сектор!! Я даже движение ему присвоил некое, он все равно не показываеться ,только эллипс и все

Re: проблема с кодом Borland C 3.1 код внутри

Добавлено: 10 мар 2011, 02:04
Nickstery
Все, нашел ошибку, даже 2)))) Надо было после жллипса убрать зайд и поставить возрастание "t" в цикле)

Re: проблема с кодом Borland C 3.1 код внутри

Добавлено: 10 мар 2011, 02:05
Nickstery
Все, нашел ошибку, даже 2)))) Надо было после эллипса убрать зайд и поставить возрастание "t" в цикле)