Skip to content

Instantly share code, notes, and snippets.

@minimedj
Forked from MaratB/снег
Last active December 23, 2015 17:59
Show Gist options
  • Save minimedj/6672353 to your computer and use it in GitHub Desktop.
Save minimedj/6672353 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();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment