Computer graphics program to draw concentric circles with different colors

0
1790

Computer graphics program in Python and C++

Python

from graphics import *
win = GraphWin("Experiment 2-2", 600, 600)
 
#title
label = Text(Point(290, 7), 'Concentric Circles')
label.draw(win)
 
#center
center = Point(300, 300)
 
#circle1
c1 = Circle(center, 70)
c1.draw(win)
 
#circle2
c2 = Circle(center, 40)
c2.draw(win)
 
win.getMouse()
win.close()
computer graphics python c++

C++

 

#include​<conio.h>
#include​<graphics.h>
int ​​main​(){
​int​​gd​ = ​DETECT​, ​gm​;​
initgraph​(&​gd​, &​gm​, ​""​);
​for​(​int​​i​ = ​0​ ; ​i​ < ​10​ ; ​i​++) {​ 
setcolor​(​i​);​circle​(​250​, ​250​, ​50​ + ​15​ *​i​);
}​
getch​();
​closegraph​();​
return​​0​;
}

LEAVE A REPLY