mardi 29 novembre 2016

Facing error in running the programming

I am trying to run this program, taking vertices of a triangle as inputs. But i am facing errors. Can someone help me with this ?

What I am trying to do create a point class, inherit in a triangle class and accept the vertices of triangle as inputs.

#include <iostream>
#include <vector>
using namespace std;

#Defines a class Point.
class Point
{
    private:
        float x;
        float y;
    public:
        int read_Point(Point &P)
        {   
            std::cin >> P.x >> P.y;
        }
};

#Defines a class Triangle
class Triangle : public Point
{
    private:
        std::vector<Point> P;
    public:
        int make_triangle()
        {
            P=std::vector<Point>(3);
            read_Traingle();
            return 0;
        }
        void read_Traingle()
        {
            read_Point(P[1]);
            read_Point(P[2]);
            read_Point(P[3]);
        }
};

int main()
{
    Triangle Tri;
    Tri.make_triangle();
    return 0;
}

Aucun commentaire:

Enregistrer un commentaire