forked from koolkarthik97/Graphics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSevenSeg.cpp
63 lines (57 loc) · 1.66 KB
/
SevenSeg.cpp
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
57
58
59
60
61
62
63
#include<iostream.h>
#include <graphics.h>
#include<math.h>
int dda(int x1,int x2,int y1, int y2)
{
int x,y,k,steps,xc,yc,dx,dy;
dx=x2-x1;
dy=y2-y1;
if(abs(dx)>abs(dy))
steps=abs(dx);
else
steps=abs(dy);
xc=(dx/steps);
yc=(dy/steps);
x=x1;
y=y1;
for(k=1;k<=steps;k++)
{
x=xc+x;
y=yc+y;
circle(x,y,3);
}
}
int main3( )
{
initwindow(400, 300, "First Sample");
int num;
cout<<"enter the number to be displayed"<<endl;
cin>>num;
switch(num)
{
case 0:
{
dda(10,100,10,10);
dda(100,100,10,200);
dda(100,10,200,200);
dda(10,10,200,10);
break;
}
case 1:{
dda(100,100,10,200);
break;}
case 2:{
dda(10,110,10,10);
dda(110,110,10,110);
dda(10,110,110,110);
dda(10,10,110,210);
dda(10,110,210,210);
break;
}
}
while (!kbhit( ))
{
delay(200);
}
return 0;
}