Условие: Программа рисует цветок, который летает по кривой...(у меня не совсем кривая...но главное летает)...надо чтоб этот цветок останавливал полет при нажатии пробела и летел дальше по нажатию двух пробелов...уже неделю мучаемся и все никак..
вот сам код
Код: Выделить всё
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<dos.h>
class cDrawing
{private:
int midx, midy;
public:
void flower(int color)
{int stangle = 180, endangle = 360;
int xrad = 30, yrad = 60;
/**************down sector********************************/
setcolor(color);
setfillstyle(SOLID_FILL,color);
sector(midx, midy, stangle, endangle, xrad, yrad);
/*************left sector*********************************/
sector(midx-10, midy, stangle, endangle-225, xrad-10, yrad-10);
/*************right sector************************/
sector(midx+10, midy, stangle-180, endangle-315, xrad-10, yrad-10);
/*************middle sector*************************/
int poly[5];
setcolor(BLACK);
poly[0] =midx;
poly[1] =midy-35;
poly[2] =midx+10;
poly[3] =midy;
poly[4] =midx-10;
poly[5] =midy;
poly[6] =poly[0];
poly[7] =poly[1];
setfillstyle(SOLID_FILL,color);
fillpoly(4,poly);
}
/******************************************/
void move()
{int z=175; char c;
while(z<426)
 {while(midx<z)
  {flower(RED);
    delay(100);
    flower(BLACK);
    midx=midx+5;
    midy=midy+5;
   }
z=z+125;
  while(midx<z)
  { flower(RED);
    delay(100);
    flower(BLACK);
    midx=midx+5;
    midy=midy-5;
   }
z=z+125;
 }
}
/*****************/
cDrawing()
{midx=50;midy=150;}
};
/*******************************************************/
int main(void)
{cDrawing p;
   /* request auto detection */
   int gdriver = DETECT, gmode, errorcode;
   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "C:\\TC\\BGI");
   /* read result of initialization */
   errorcode = graphresult();
   if (errorcode != grOk)  /* an error occurred */
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1); /* terminate with an error code */
   }
p.flower(RED);
p.move();
/******************************************/
   /* clean up */
   getch();
   closegraph();
   return 0;
}




 . Итак:
 . Итак:


 )
)

 Вернее, эмуляция goto другими средствами
 Вернее, эмуляция goto другими средствами