On the screen I\'ll need you to draw 4 boxes with the following background color
ID: 3704839 • Letter: O
Question
On the screen I'll need you to draw 4 boxes with the following background colors IN THIS ORDER:
- red
-blue
- purple
Each box has a height of 200px
At screen size of 639px or less all 4 boxes should take up 100% of the screen
Between 640px and 799px the boxes will be 75% of the screen size
Between 800px and 999px the boxes will be 50% of the screen and should have a 5px margin
Anything greater than 1000px the boxes should be 20% with a 10px margin
Anything 1440px or greater the boxes should flip (new order would be purple, green, blue, red) order and be right aligned.
Design Mode No throttling ; DPR: 2 ; x 640 831 no device selectedExplanation / Answer
/*Graphics Program to display the 4 boxes one after another with different colours*/
#include<graphics.h>
#include<conio.h>
int main(){
int gd=DETECT,gm;
initgraph(&gd,&gm,"X:\TC\BGI");
/* Draw White Screen*/
setcolor(WHITE);
rectangle(1000,1000,1000,1000);
setfillstyle(SOLID_FILL,WHITE);
floodfill(1000,1000,WHITE);
/* Draw Rectangles */
setcolor(WHITE);
rectangle(640,200,730,831);
rectangle(640,200,730,831);
rectangle(640,200,730,831);
rectangle(640,200,730,831);
/* Fill colours for rectangles*/
setfillstyle(SOLID_FILL,RED);
floodfill(640,200,RED);
setfillstyle(SOLID_FILL,BLUE);
floodfill(640,200,BLUE);
setfillstyle(SOLID_FILL,GREEN);
floodfill(640,200,GREEN);
setfillstyle(SOLID_FILL,PURPLE);
floodfill(640,200,PURPLE);
/*If the screen size increaces we should change the colours filled in rectangles*/
size(1400,1400);
fill(#B6FF00); /*Hexadecimal code to change the colors filled in rectangles*/
getch();
closegraph();
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.