forked from dharmanshu1921/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc++.cpp
More file actions
42 lines (36 loc) · 1012 Bytes
/
c++.cpp
File metadata and controls
42 lines (36 loc) · 1012 Bytes
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
// A C program to make a rainbow. This program would only
// work in Turbo C compiler in DOS compatible machine
#include<stdio.h>
#include<graphics.h>
#include<dos.h>
// function for making of rainbow
void rainbow()
{
// auto detection
int gdriver = DETECT,gmode;
int x, y, i;
// initialize graphics mode(passed three arguments to
// initgraph function)
// &gdriver is the address of gdriver variable, &gmode is
// the address of gmode and
// "C:\\Turboc3\\BGI" is the directory path where BGI files are stored
initgraph(&gdriver,&gmode,"C:\\Turboc3\\BGI");
x = getmaxx() / 2;//finding centre x-ordinate of screen
y = getmaxy() / 2;//finding centre y-ordinate of screen
for (i=30; i<200; i++)
{
// delay function under dos.h for holding the
// function for some time
delay(100);
// selecting color for making of rainbow
setcolor(i/10);
// making of arc with fixed centre and increasing radius
arc(x, y, 0, 180, i-10);
}
}
// driver program
int main()
{
rainbow();
return 0;
}