-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy path10. Sunrise and Sunset.cpp
More file actions
75 lines (68 loc) · 1.55 KB
/
10. Sunrise and Sunset.cpp
File metadata and controls
75 lines (68 loc) · 1.55 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
#include<iostream>
#include<graphics.h>
#include<cstdlib>
#include<dos.h>
#include<cmath>
using namespace std;
int main()
{
initwindow(800,500);
int x0,y0;
int gdriver = DETECT,gmode,errorcode;
int xmax,ymax;
errorcode=graphresult();
if(errorcode!=0)
{
cout<<"Graphics error:"<<grapherrormsg(errorcode);
cout<<"Press any ket to halt";
exit(1);
}
int i,j;
setbkcolor(BLUE);
setcolor(RED);
rectangle(0,0,getmaxx(),getmaxy());
outtextxy(250,240,"::::PRESS ANY KEY TO CONTINUE:::::");
while(!kbhit());
for(i=50,j=0;i<=250,j<=250;i+=5,j+=5)
{
delay(120);
cleardevice();
if(i<=150)
{
setcolor(YELLOW);
setfillstyle(1,YELLOW);
fillellipse(i,300-j,20,20);
}
else
{
setcolor(GREEN^RED);
setfillstyle(1,GREEN^RED);
fillellipse(i,300-j,20,20);
}
}
delay(1000);
cleardevice();
setcolor(RED);
setfillstyle(1,RED);
fillellipse(300,50,20,20);
delay(150);
int k,l;
for(k=305,l=55;k<=550,l<=300;k+=5,l+=5)
{
delay(120);
cleardevice();
if(k<=450)
{
setcolor(GREEN^RED);
setfillstyle(1,GREEN^RED);
fillellipse(k,l,20,20);
}
else
{
setcolor(YELLOW);
setfillstyle(1,YELLOW);
fillellipse(k,l,20,20);
}
}
return 0;
}