Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Programming language is C++. Show finished code and an example of the output on

ID: 3802373 • Letter: P

Question

Programming language is C++. Show finished code and an example of the output on XMing. Use g++ -std=c++17 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

#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;
}

this is the c++ code for olympic flag which has white background and other color circles.

here circle thickness is 5px, so i use for loop for draw thickness of circle and radius to draw thickness.

I use some graphics function like circle ,setcolor for drawing circles.