Untraceable error in c++ code involving classes

I've written a c++ program that contains the following classes: class Shape, Circle, Ellipse, Rectangle, Triangle. All the classes are a subclass of class Shape. They syntax of their definition is fine, I see no visible errors. This is the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "graphics.h"
//#include <iostream>
using namespace std;

const float Pi = 3.141;

float distance (int x1, int y1, int x2, int y2) {
    int x = x2 - x1;
    int y = y2 - y1;
    x = x * x;
    y = y * y;
    float total = x + y;
    float length = sqrt(total);
    return length;
}


class Shape {
public: 
    float area;  
    virtual void Area () = 0;
};

class Rectangle : public Shape {
public:
    int length, width;
    virtual void Area () {
        area = length * width;
    }
};

class Triangle : public Shape {
public:
    float a, b, c;
    virtual void Area () {
        float s = ((a + b + c) / 2);
        area = sqrt(s * (s - a) * (s - b) * (s - c));
    }
};

class Ellipse : public Shape {
public:
    int x, y; 
    float a, b; 
    virtual void Area () {
        area = Pi * a * b;
    }
};

class Circle : public Shape { 
public:
    int x, y; 
    float radius; 
    virtual void Area () {
        area = Pi * radius * radius;
    }
};

class Line { //implement zigzag within Line
public:
    int x, y; //last point of line segment
};


Now when I declare a variable of each subclass in the main, I get an error on two of the classes.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
int main ()
{
    Circle a;
    Rectangle b;
    Ellipse d;
    Triangle c;
    int x1, y1;
    float length;
    paintInterface ();
    int xcoord, ycoord;
    bool flag = true;
    while (flag) {
    while(!ismouseclick(WM_LBUTTONDOWN)) {}
    getmouseclick(WM_LBUTTONDOWN, xcoord, ycoord);

    if (((xcoord >= 0) && (xcoord <= 35)) && ((ycoord >= 5) && (ycoord <= 20))) {
        paintInterface ();
    }
    }


...And there's a bunch of similar if conditions.

My compiler gives an error under b and d, i.e. the Rectangle object and the Ellipse object. The error is, "Expected a ';'" . I have quadruple checked every inch of my code and as far as I can tell, there are no missing semicolons. Where this ";" belongs is beyond me, any help will be appreciated.
It would be helpful if you posted the error verbatim as well as pointing us to the line of code it's complaining about. You don't seriously expect someone to compile your code for you, do you?
The compiler underlines the "b" and "d" giving the error (verbatim) : "Expected a ';' ".
Topic archived. No new replies allowed.