Facebook
From 123, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 230
  1. #include <stdio.h>      //printf/getch itp.
  2. #include <conio.h>      //kbhit()
  3. #include <graphics.h>   //funkcje graficzne BGI
  4. #include <windows.h>    //Sleep(xx)
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <time.h>
  8. int main()
  9. {
  10.     int GraphDriver = DETECT;
  11.     int GraphMode;
  12.     int ErrorCode;
  13.     initgraph(&GraphDriver, &GraphMode,"");
  14.     ErrorCode = graphresult();
  15.     if(ErrorCode != grOk)
  16.     {
  17.         printf("Blad trybu graficznego: %s\n", grapherrormsg(ErrorCode) );
  18.         exit(1);
  19.     }
  20.     //Tutaj kod związany z rysowaniem
  21.     //******************************************************************************************************************
  22.     double x, y, i, lel, k;
  23.     srand(time(NULL));
  24.         x = rand()%100+250;
  25.         y = rand()%100+150;
  26.     for(i = 0 ; i<=130000 ; i++)
  27.     {
  28.         lel = rand()%10;
  29.  
  30.         if(lel<=5)
  31.         {
  32.             x = -0.4*x-1;
  33.             y = -0.4*y+0.1;
  34.  
  35.         }
  36.         else
  37.         {
  38.             x = 0.76*x-0.4*y;
  39.             y = 0.4*x+0.76*y;
  40.         }
  41.         if(i>100)
  42.         {
  43.         putpixel(x*400+450, y*400+240, k);
  44.         }
  45.         printf("%lf\t\t%lf", x, y);
  46. k+=50000;
  47.  
  48.  
  49.     }
  50.     //******************************************************************************************************************
  51.     //koniec rysowania
  52.     //program czeka na naciœniêcie klawisza i ZAMYKA tryb graficzny!
  53.     fflush(stdin);
  54.     getch(); //tylko zatrzymanie programu, żeby nie zamykał natychmiast okna graficznego
  55.     closegraph(); //koniec trybu graficznego
  56.  
  57.     return(0);
  58. }
  59.