home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
scase.zip
/
SCASE.Z
/
SAMPLE.CC
< prev
next >
Wrap
C/C++ Source or Header
|
1994-10-18
|
725b
|
40 lines
#include "shape.h"
#include "line.h"
#define NUMSHAPES 10
void CreateShapes(Shape *Shapes[], int NumShapes);
void main()
{
// Create shapes
Shape *Shapes[NUMSHAPES];
CreateShapes(Shapes, NUMSHAPES);
// Draw shapes
for (int i=0; i<NUMSHAPES; i++)
Shapes[i]->Draw();
// Delete shapes
for (i=0; i<NUMSHAPES; i++)
delete Shapes[i];
}
void CreateShapes(Shape *Shapes[], int NumShapes)
{
for (int i=0; i<NumShapes; i++)
{
switch (i%3)
{
case 0:
Shapes[i] = new Line('*', 10);
break;
case 1:
Shapes[i] = new Line('+', 20);
break;
case 2:
Shapes[i] = new Line('x', 30);
break;
}
}
}