<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\begin{fileverb}
*-----------------------------------------------------------------------*/
/*  FILE:  shapes_v1.cpp (Eighth C++ Lab Exercise 1)                    */
/*  WGET:  wget http://oceanai.mit.edu/cpplabs/shapes_v1.cpp            */
/*  RUN:   shapes_v1                                                    */
/*----------------------------------------------------------------------*/

#include &lt;iostream&gt;      // For use of the cout function       
#include "Triangle.h"
#include "Square.h"

using namespace std;

int main()
{
  Triangle triangle;
  Vertex t_vertex1(0,0);
  Vertex t_vertex2(10,0);
  Vertex t_vertex3(5,5);
  triangle.addVertex(t_vertex1);
  triangle.addVertex(t_vertex2);
  triangle.addVertex(t_vertex3);

  Square square;
  Vertex s_vertex1(0,0);
  Vertex s_vertex2(10,0);
  Vertex s_vertex3(10,10);
  Vertex s_vertex4(0,10);
  square.addVertex(s_vertex1);
  square.addVertex(s_vertex2);
  square.addVertex(s_vertex3);
  square.addVertex(s_vertex4);

  cout &lt;&lt; "Triangle: " &lt;&lt; triangle.getSpec() &lt;&lt; endl;
  cout &lt;&lt; "Square:   " &lt;&lt; square.getSpec() &lt;&lt; endl;

  return(0);
}
\end{fileverb}

\begin{fileverb}
/*----------------------------------------------------------------------*/
/*  FILE:  Triangle.h                                                   */
/*  WGET:  wget http://oceanai.mit.edu/cpplabs/Triangle.h               */
/*----------------------------------------------------------------------*/

#ifndef TRIANGLE_HEADER
#define TRIANGLE_HEADER

#include "SegList.h"

class Triangle : public SegList {
 public:
  Triangle() {};
  ~Triangle() {};

  std::string getSpec() const;   // recall const just means that this function
};                               // won't alter the state of an instance.

#endif
\end{fileverb}

\begin{fileverb}
/*----------------------------------------------------------------------*/
/*  FILE:  Triangle.cpp                                                 */
/*  WGET:  wget http://oceanai.mit.edu/cpplabs/Triangle.cpp             */
/*----------------------------------------------------------------------*/

#include "Triangle.h"

using namespace std;

//-----------------------------------------------------------------------
// Procedure: getSpec() 

string Triangle::getSpec() const
{
  string spec = "type=triangle,";
  spec += SegList::getSpec();
  return(spec);
}
\end{fileverb}

\begin{fileverb}
/*----------------------------------------------------------------------*/
/*  FILE:  Square.h                                                     */
/*  WGET:  wget http://oceanai.mit.edu/cpplabs/Square.h                 */
/*----------------------------------------------------------------------*/

#ifndef SQUARE_HEADER
#define SQUARE_HEADER

#include "SegList.h"

class Square : public SegList {
 public:
  Square() {};
  ~Square() {};

  std::string getSpec() const;
};

#endif
\end{fileverb}

\begin{fileverb}
/*----------------------------------------------------------------------*/
/*  FILE:  Square.cpp                                                   */
/*  WGET:  wget http://oceanai.mit.edu/cpplabs/Square.cpp               */
/*----------------------------------------------------------------------*/

#include "Square.h"

using namespace std;

//-----------------------------------------------------------------------
// Procedure: getSpec() 

string Square::getSpec() const
{
  string spec = "type=square,";
  spec += SegList::getSpec();
  return(spec);
}
\end{fileverb}



</pre></body></html>