.


:




:

































 

 

 

 


1.3.




 

, Circle, Rectangle RightTriangle. figures :

 

<> < > < >

 

(), r () t ( ). . . .

 

c 0,5 0,5 0,25 // (1/2, 1/2) 1/4

r 1,0 0,25 0,5 0,5 // (1, 1/4)

// 1/2, 1/2

t 2,0 0,75 0,25 0,5 //

// (2, 3/4) 1/4, 1/2

 

. .

 

#include <lostream.h>

#include <fstream.h>

#include <stdlib.h>

 

#include graphlib.h

#include shapelst.h

 

void main (void)

{

//listHeader

NodeShape listHeader, *p, *nFig;

 

//: c (), r (),

//t ( )

char figType;

 

//

int pat = 0;

float x, y, radius, length, width, tb, th;

 

// fin

ifstream fin;

 

// figures,

fin.open (figures, ios::in | ios::nocreate);

if (!fin)

{

cerr << figures << end1;

exit1;

}

 

// p

p = &listHeader;

 

//

//

while (!fin.eof())

{

//

fin >> figType;

if (fin.eof())

break;

fin >> x >> y;

//

switch (figType)

{

case c:

//

fin >> radius;

nFig = new CircleFigure (x, y, radius, pat);

p -> InsertAfter (nFig);

break;

case r:

//

fin >> length >> width;

nFig = new RectangleFigure (x, y, length, width, pat);

p -> InsertAfter (nFig);

break;

case t:

//

fin >> tb >>th;

nFig = new RectangleFigure (x, y, tb, th, pat);

p -> InsertAfter (nFig);

break;

}

 

// .

pat = (pat+1) % 12;

p = p->Next();

}

//

InitGraphics();

 

// 1- ,

//

p = listHeader.Next();

while (p!= &listHeader)

{

p -> Draw();

p = p->Next();

}

 

//

//

ViewPause();

ShutdownGraphics();

}

 

/*

< 1.3>

<. >

*/

               
   
     
   
 
 

 

 


 

           
   
 
   
 
 

 

 





:


: 2015-09-20; !; : 299 |


:

:

.
==> ...

1515 - | 1350 -


© 2015-2024 lektsii.org - -

: 0.009 .