Skip to content

Instantly share code, notes, and snippets.

@MaratB
Last active December 23, 2015 16:49
Show Gist options
  • Save MaratB/6664512 to your computer and use it in GitHub Desktop.
Save MaratB/6664512 to your computer and use it in GitHub Desktop.
#include <graphics.h>
#include <conio.h>
#include <stdlib.h>
int random (int N) { return rand() % N; }
main()
{
int x, y, R, G, B;
initwindow (500, 500);
while ( ! kbhit () ) //пока не нажата клавиша
{
x = random(500);
y = random(500);
R = random(256); //
G = random(256);
B = random(256);
if ( getpixel(x,y) != 0 ) // если пиксель не черного цвета
putpixel ( x, y, 0 ); //делаем его черным
else
putpixel ( x, y, COLOR(R,G,B) ); // если черный, то меняем цвет
}
getch();
closegraph();
}
@minimedj
Copy link

Плохо оформлен код, смотри как надо: https://gist.github.com/minimedj/6672353

Обрати внимание на именивание файлов.

Твой юмор в виде "снег :D" на месте имени фала не уместен. Смотри как я файл назвал. Правильное название дает подсветку.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment