Programming language is C++. Show finished code and an example of the output on
ID: 3804672 • Letter: P
Question
Programming language is C++. Show finished code and an example of the output on XMing. Use g++ -std=c++17 *cpp -lfltk -lfltk_images to compile the code on PuTTY.
(20 Write ELTK program named hw5pr3.cpp to draw the official points alternate Olympic flag, which has a black background and a white circle where the usual Olympic flag has a white background and a black circle Look up the colors of the other circles. Make the circles have a thickness of 5 pixels. Don't worry about making the circles overlap correctly. Olympic trivia: These 6 colors were reportedly chosen because every nation's flag can be drawn with these 6 colors. Hint: Sketch it on graph paper by drawing around a quarter to get approximate coordinates. Name your program hw5pr3.cpp.Explanation / Answer
hw5pr3.cpp
#include <graphics.h>
#include <conio.h>
main()
{
int gd = DETECT, gm,i;
initgraph(&gd, &gm, "C:\TC\BGI");
setbkcolor(WHITE);
for(i= 45 ; i< 50 ; i++)
{
setcolor(3);
circle(100,100,i);
floodfill(100,100,3);
}
for(i= 45 ; i< 50 ; i++)
{
setcolor(8);
circle(220,100,i);
floodfill(220,100,8);
}
for(i= 45 ; i< 50 ; i++)
{
setcolor(4);
circle(340,100,i);
floodfill(340,100,4);
}
for(i= 45 ; i< 50 ; i++)
{
setcolor(14);
circle(160,150,i);
floodfill(160,150,14);
}
for(i= 45 ; i< 50 ; i++)
{
setcolor(2);
circle(280,150,i);
floodfill(280,150,2);
}
getch();
closegraph();
return 0;
}
Here in program i used color code for fill color,a color code value is like this:
Name Value BLACK 0 BLUE 1 GREEN 2 CYAN 3 RED 4 MAGENTA 5 BROWN 6 LIGHTGRAY 7 DARKGRAY 8 LIGHTBLUE 9 LIGHTGREEN 10 LIGHTCYAN 11 LIGHTRED 12 LIGHTMAGENTA 13 YELLOW 14 WHITE 15Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.