Iteration Exercise 1

Develop a program using a for loop, that will allow any number of shaded area to be entered and the areas to be tiled calculated.

Algorithm

TileCalculation
    read room length
    read room width
    non tiling area:= 0

    read number of shaded areas
    repeat number of shaded area times
        read shaded length
        read shaded width
        non tiling area:= non tiling area + shaded length * shaded width
    end repeat

    area to tile:= room length * room width - non tiling area
    write area to tile
End.


Data Item Table

Data Item Program name Size/Type Range
Room length roomLength float
Room width roomWidth float
Number of shaded areas numShaded integer
Non tiling area nonTiling float
Shaded length shadedLength float
Shaded width shadedWidth float
Area of tile areaToTile float


PROGRAM: tilefor.cpp