Hi I'm new to coding. Can someone please help with a linked list problem. I'm getting numbers for output, I think they are addresses. The output I'm getting is:
HEAD CODE
-12086434400
1080131584
TAIL CODE
The output I need is:
HEAD CODE
<rect x="0" y="0" width ="200" height="200" stroke-width="2" stroke="red" fill="none" />
<rect x="14" y="140" width ="140" height="14" stroke-width="2" stroke="red" fill="none" />
TAIL CODE
I know it has something to do with the switch. I know that code is right but I'm not utilising it.
Thanks
#include <iostream>
#include <string>
#include <cassert>
using namespace std;
class Path
{
public:
//stub
}; // Path
class Circle
{
public:
//stub
}; // Circle
class Rectangle
{
public:
Rectangle();
Rectangle(double x, double y, double w, double h, string c = "red", string f = "none");
void Print(ostream & out) const;
private:
double rx, ry, width, height;
string colour, fill;
};
ostream & operator<<(ostream & out, const Rectangle & rectangle);
class DataType
{
public:
enum { EMPTY, PATH, CIRCLE, RECTANGLE } SVGObj;
union
{
Path *path;
Circle *circle;
Rectangle *rectangle;
};
DataType();
DataType(const DataType &);
DataType(const Circle & obj);
DataType(const Path & obj);
DataType(const Rectangle & obj);
};
struct LNode
{
DataType data;
LNode *next;
};
typedef LNode* LNodePtr;
class Svg
{
public:
Svg(double w, double h);
~Svg(); //destructor
void Head(ostream & out) const;
void Tail(ostream & out) const;
void Print(ostream & out) const;
void Append(const Path & obj);
void Append(const Circle …