C++:Flags with Rectangles Tutorial

From Progzoo
Jump to navigation Jump to search


The flag of Libya is a simple green rectangle.

Try the program as it is given, then change it so that the green rectangle is 150 wide.


[Font] [Default] [Show] [Resize] [History] [Profile]


The flag of France is blue, white and red. The code given draws only one of the three rectangles required, and it is in the wrong place.
Flag guide france.png

[Font] [Default] [Show] [Resize] [History] [Profile]


The flag of Germany is black, red and yellow.

Only one of the three rectangles has been drawn - and that one is in the wrong place.

[Font] [Default] [Show] [Resize] [History] [Profile]


  • The flag of Palau is a yellow circle on a blue background.
  • The rectangle is 150 by 100.
  • The circle is centred on position 50,50, radius is 25.
  • Use ColorRGB(0.60,0.69,0.85) for the blue colour.
  • The dark lines are NOT part of the flag. They are shown as guides only.

In order to draw a circle you need to track down an appropriate object to pass to the draw() method.

[Font] [Default] [Show] [Resize] [History] [Profile]