/* Program 1.6 */ /* Lines */ /* Used header fies */ #include #include #include #include /* Main function - our program */ int main(void) { int loop_counter; unsigned int line_colour; int driver,mode,err=0; int x_line_start; int y_line_start; int x_line_end; int y_line_end; driver = DETECT; mode = VDIMODE; initgraph(&driver, &mode, ""); err = graphresult(); if(err) { puts(grapherrormsg(err)); return(err); } srand(32000); for (loop_counter=1;loop_counter<=3000;loop_counter++) { x_line_start=random(getmaxx()); y_line_start=random(getmaxy()); x_line_end=random(getmaxx()); y_line_end=random(getmaxy()); line_colour=(random(16)); setcolor(line_colour); line(x_line_start,y_line_start,x_line_end,y_line_end); } getch(); /* wait for keyboard event */ closegraph(); return(graphresult()); }