-
Notifications
You must be signed in to change notification settings - Fork 0
/
gasket_thr_point.c
56 lines (36 loc) · 1.09 KB
/
gasket_thr_point.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <stdio.h>
#include <time.h>
#include <graphics.h>
void garket(int x1, int y1, int x2, int y2, int x3, int y3, int new_pt_x, int new_pt_y)
{ int mid_x, mid_y;
delay(5);
int rand_no = (rand() % 3) + 1;
switch(rand_no)
{
case 1: mid_x = (x1 + new_pt_x )/2.0;
mid_y = (y1 + new_pt_y )/2.0;
break;
case 2: mid_x = (x2 + new_pt_x )/2.0;
mid_y = (y2 + new_pt_y )/2.0;
//line(x2,y2, mid_x, mid_y);
break;
case 3 : mid_x = (x3 + new_pt_x )/2.0;
mid_y = (y3 + new_pt_y )/2.0;
//line(x3,y3, mid_x, mid_y);
break;
}
putpixel(mid_x,mid_y, WHITE);
//line(mid_x,mid_y,new_pt_x,new_pt_y);
garket(x1,y1,x2,y2,x3,y3, mid_x, mid_y);
}
int main()
{ int gd = DETECT,gm=0;
int x1=300,x2=100,x3=500,y1=40,y2=400,y3=400;
int new_pt_x = 0;
int new_pt_y = 0;
initgraph(&gd,&gm,NULL);
srand(time(NULL));
garket(x1,y1,x2,y2,x3,y3, new_pt_x, new_pt_y);
getch();
closegraph();
}