Zoo tutorials: [ SQL | Linux | XML ]
ProgZoo: [ Java | C# | VB | C++ | Perl ]
Log in

A Gentle Introduction to
C++ Programming

Tutorial: Using and reusing stars

 
Drawing flags: reusing shapes.

1. Vietnam


Big

The flag of Vietnam has a yellow five pointed star on a red background. This star is a popular device on many flags, we define the star once and use it many times in later flags.

Flag of Vietnam: a yellow star on red.

The given star has a radius of 100, it is centred on 0,0 which is the wrong place. We must translate to put it in the right place.

We use a slightly different method to draw shapes now. We construct a list of actions then execute them in one go.
Hint:

2. Panama


Big

The flag of Panama requires two stars. We can draw the same star twice.

Flag of the Panama.

3. Bosnia and Herzegovina


Big

The flag of Bosnia and Herzegovina includes 9 white stars. Each star is 38 right and 38 below the previous star.

Flag of Bosnia and Herzegovina.

4. Democratic Republic of Congo (formerly Zaire)


Big

The large star has a radius of 100, the 6 smaller stars have a radius of 10.

Flag of Democratic Republic of Congo.